onLoginActivityResult
client.onLoginActivityResult( requestCode, resultCode, intent, success, failure, activity )
About this command
This method is meant to be called within your onActivityResult
override following any of below login methods:
-
loginWithProvider
(for web-based flows)
Calling this method with a non-ReachFive request code will have no effect (noop); no exception will be thrown, but a debug-level log is emitted for development purposes. |
Use ReachFive.isReachFiveLoginRequestCode to probe whether the request code belongs to ReachFive.
|
Examples
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// Method A
// Tip: nothing happens if the request code does not concern ReachFive
client.onLoginActivityResult(
requestCode = requestCode,
resultCode = resultCode,
intent = data,
success = { handleLoginSuccess(it) },
failure = { reachFiveError ->
Log.e(TAG, "Login error!", reachFiveError)
},
activity = this
)
// Method B
val handler: ActivityResultHandler? = reach5.resolveResultHandler(requestCode, resultCode, data)
when (handler) {
is LoginResultHandler -> handler.handle(
success = { handleLoginSuccess(it) },
failure = { reachfiveError ->
Log.e(TAG, "Login error!", reachfiveError)
},
activity = this
)
else -> { /* Not a login callback, or not ReachFive */ }
}
}
Parameters
The Android request code obtained in |
|
Identifies the return result of the authentication callback when the result arrives. |
|
The intent received after launching the activity to retrieve the authentication callback result. |
|
Callback called once the authentication callback has succeeded. You’ll get an |
|
Callback called once the request has failed. You’ll get a |
|
The Android activity. |
Response
Type: Unit
AuthToken
The authentication token.
idToken |
The ID token JSON Web Token (JWT) that contains the profile’s information. |
||||||||||||||||||||||||||||||||||
accessToken |
The authorization credential JSON Web Token (JWT) used to access the ReachFive API. |
||||||||||||||||||||||||||||||||||
refreshToken |
The refresh token JSON Web Token (JWT) used to obtain new access tokens once they expire. |
||||||||||||||||||||||||||||||||||
tokenType |
The type of token. Always equal to |
||||||||||||||||||||||||||||||||||
expiresIn |
The lifetime in seconds of the access token. If |
||||||||||||||||||||||||||||||||||
user OpenIDUser |
The user’s information contained in the ID token.
|
ReachFiveError
message |
The message of the error. |
||||||||||||||
getErrorCode() |
The error code’s enumeration value. |
||||||||||||||
code |
The HTTP status code or SDK error code. |
||||||||||||||
exception |
The stack trace of the error. |
||||||||||||||
data |
Additional data about the error.
|