Step 3. Authenticating with external IdPs
PingOne Advanced Identity Cloud PingAM Android
Your app must handle the relevant node types your server returns when a user attempts to authenticate using an external IdP.
When encountering the IdpCallback, call authorize() to begin authentication with the external IdP:
var node = journey.start()
if (node is ContinueNode) {
node.callbacks.forEach { callbacks ->
if (callback is IdpCallback) {
val idp = callback
val redirectUri = "myapp://callback".toUri()
when (val result = idp.authorize(redirectUri = redirectUri)) {
is Success -> {
// Authentication successful, proceed to the next step in the DaVinci flow
node = node.next()
// Process the next node
}
is Failure -> {
// Authentication failed, handle the error
val error: Throwable = result.error
// Log or display the error message
}
}
return // Assuming only one IdpCallback per node
}
}
}
The authorize() method returns a Success result when authentication with the external IdP completes successfully. If not, it returns Failure and Throwable which shows the root cause of the issue.
val result = idp.authorize()
result.onSuccess {
// Move to next Node
}
result.onFailure {
it // The Throwable
}