Orchestration SDKs

Resuming journeys using magic links on Android

PingOne Advanced Identity Cloud PingAM Android

To resume a journey in an Android app, complete the following tasks:

Step 1. Capturing the resume URI

Configure your Android application to launch when the user clicks the magic link in their email.

After launching, capture the URI that was clicked so you can resume authentication.

Step 2. Resuming a suspended authentication journey

Pass the captured URI into the journey.resume() method to continue the journey, rather than calling journey.start() to start again.

Step 1. Capturing the resume URI

Your application must capture the resume URI that the server emails to the user. That URI contains a unique suspendedId parameter that it uses to resume the user’s journey on the server.

You must register your Android app to launch when the user clicks the resume URI, so that they can continue their journey in your app. If you don’t register an app to handle the resume URI, clicking a magic link launches your server’s login UI in a browser instead.

We recommend using either deep links, or app links to associate your Android app with your resume URI.

Your app should capture the URI value that opened it, as you’ll need to pass that value back to your server to resume the authentication journey:

Example of capturing the resume URI that opened an Android app
// In Activity or ViewModel handling deep links
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.main)

    val resumeUri: Uri? = intent?.data
}

Step 2. Resuming a suspended authentication journey

After obtaining the resumeUri, use it in your application to continue the user’s authentication or registration journey.

Use the Journey module’s resume() method, rather than start(), to continue the journey using the resumeUri as follows:

Resuming a journey on Android
var node = journey.resume("resumeUri")

// Handle nodes just like starting new journey…​
when (node) {
    is ContinueNode -> {
        // Proceed to the next step in the authentication journey
        val nextNode = node.next()
    }
    is ErrorNode -> {
        // Handle server-side errors (e.g., invalid credentials)
        val errorMessage = node.message
        node.input["name"] // Access the raw JSON response with the input attribute
        // Display error to the user
    }
    is FailureNode -> {
        // Handle unexpected errors (e.g., network issues, unexpected errors like parsing response)
        val errorCause = node.cause
        // Log the error and potentially display a generic message
    }
    is SuccessNode -> {
        // Authentication successful, retrieve the session
        val session = node.session
        node.input["name"] // Access the raw JSON response with the input attribute
        // Proceed with post-authentication actions
    }
}

If the URI scheme, host, or port in the resumeUri does not match the server configured for the journey, the SDK throws an exception.