---
title: Step 3. Handling IdpCollector nodes
description: Your app must handle the IdpCollector node type that DaVinci sends when a user attempts to authenticate using an external IdP.
component: sdks
version: latest
page_id: sdks:davinci:use-cases/social-login/android/03_handling_idpcollector_nodes
canonical_url: https://docs.pingidentity.com/sdks/latest/davinci/use-cases/social-login/android/03_handling_idpcollector_nodes.html
revdate: Tue, 25 Mar 2025 11:00:37 +0100
keywords: ["DaVinci", "Flows", "Tutorial", "Source Code", "Integration", "SDK", "Android"]
---

# Step 3. Handling IdpCollector nodes

Your app must handle the `IdpCollector` node type that DaVinci sends when a user attempts to authenticate using an external IdP.

When encountering an `IdpCollector` node type, call `idpCollector.authorize()` to begin authentication with the external IdP:

```kotlin
var node = daVinci.start()

if (node is ContinueNode) {
    node.collectors.forEach {
        when (it) {
            is IdpCollector -> {
                when (val result = idpCollector.authorize()) {
                    is Success -> {
                        // When success, move to next Node
                        node.next()
                    }
                    is Failure -> {
                        // Handle the failure
                    }
                }
            }
        }
    }
}
```

The `idpCollector.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 = idpCollector.authorize()

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

The result resembles the following:

![An Android app with three external IdP options; Google, Apple, and Facebook.](../../../_images/social-sign-on-example.png)Figure 1. An Android app with three external IdP options: Google, Apple, and Facebook.
