Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errorCode='NOT_DEFINED #160

Open
RubyJSeo opened this issue Jan 22, 2024 · 0 comments
Open

errorCode='NOT_DEFINED #160

RubyJSeo opened this issue Jan 22, 2024 · 0 comments

Comments

@RubyJSeo
Copy link

RubyJSeo commented Jan 22, 2024

I'm not sure the reason for this error:

LineLoginResult{responseCode=CANCEL, nonce='null', lineProfile=null, lineIdToken=null, friendshipStatusChanged=null, lineCredential=null, errorData=LineApiError{httpResponseCode=-1, message='', errorCode='NOT_DEFINED'}}

`class TestActivityForLine : AppUpdateActivity() {
private lateinit var binding: ActivityTestForLineBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityTestForLineBinding.inflate(layoutInflater)
setContentView(binding.root)

    binding.button.setOnClickListener {
        try {
            val loginIntent = LineLoginApi.getLoginIntent(
                this@TestActivityForLine,
                LINE_CHANNEL_ID,
                LineAuthenticationParams.Builder()
                    .scopes(listOf(Scope.PROFILE))
                    .build()
            )
            startActivityForResult(loginIntent, REQUEST_CODE_LINE_LOGIN)
        } catch (e: Exception) {
            Logger.e("line login error: ${e.message}")
        }
    }
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    if (requestCode == LoginModule.REQUEST_CODE_LINE_LOGIN) {
        val result = LineLoginApi.getLoginResultFromIntent(data)
        Logger.e("line result: ${result}")
        Logger.e("line reponseCode: ${result.responseCode}")
        Logger.e("line resultCode: ${resultCode}")
        when (result.responseCode) {
            LineApiResponseCode.SUCCESS -> {
                // Login successful
                val transitionIntent = Intent(
                    this,
                    LauncherActivity::class.java
                )
                transitionIntent.putExtra("line_profile", result.lineProfile)
                transitionIntent.putExtra("line_credential", result.lineCredential)
                startActivity(transitionIntent)

            }
            LineApiResponseCode.CANCEL -> CustomSnackbar.error(this, result.errorData.toString(), Snackbar.LENGTH_LONG)
            else -> {
                CustomSnackbar.error(this, result.errorData.toString(), Snackbar.LENGTH_LONG)
            }
        }
    }
}

companion object {
    const val REQUEST_CODE_LINE_LOGIN = 1
    private const val LINE_CHANNEL_ID = "mychannelID"
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant