line-sdk-android
line-sdk-android copied to clipboard
errorCode='NOT_DEFINED
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"
}
}`