---
title: Step 3. Authenticating with external IdPs
description: PingOne Advanced Identity Cloud PingAM Android
component: orchsdks
page_id: orchsdks:journey:use-cases/external-idp/android/03_authenticate_with_external_idps
canonical_url: https://developer.pingidentity.com/orchsdks/journey/use-cases/external-idp/android/03_authenticate_with_external_idps.html
revdate: Tue, 25 Mar 2025 11:00:37 +0100
keywords: ["DaVinci", "Flows", "Tutorial", "Source Code", "Integration", "SDK", "Android"]
---

# Step 3. Authenticating with external IdPs

[icon: circle-check, set=far]PingOne Advanced Identity Cloud [icon: circle-check, set=far]PingAM [icon: android, set=fab]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:

```kotlin
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.

```kotlin
val result = idp.authorize()

result.onSuccess {
    // Move to next Node
}
result.onFailure {
    it // The Throwable
}
```
