User Management

How to manage your authenticated user in Android

Get user

Once your user has been authenticated, you can call passage.getCurrentUser() which will return a PassageUser instance. When the user is no longer authenticated, this method will return null.

Here's an example:

suspend fun printUserId() {
    val user = passage.getCurrentUser()
    user?.let {
        print("User ID: ${}")
    } ?: print("No authenticated user")

And here's what the PassageUser class looks like:

final class PassageUser private constructor(

    /* When this user was created */
    val createdAt: String? = null,

    /* The user's email */
    val email: String? = null,

    /* Whether or not the user's email has been verified */
    val emailVerified: Boolean? = null,

    /* The userID (referred to as Handle) */
    val id: String? = null,

    /* The last time this user logged in */
    val lastLoginAt: String? = null,

    /* How many times the user has successfully logged in */
    val loginCount: Int? = null,

    /* The user's phone */
    val phone: String? = null,

    /* Whether or not the user's phone has been verified */
    val phoneVerified: Boolean? = null,

    /* User status: active, inactive, pending */
    val status: String? = null,

    /* When this user was last updated */
    val updatedAt: String? = null,

    /* The user's metadata */
    val userMetadata: Any? = null,

    /* Whether or not the user has authenticated via webAuthn before (if len(WebAuthnDevices) > 0) */
    val webauthn: Boolean? = null,

    /* The list of devices this user has authenticated with via webAuthn */
    val webauthnDevices: List<PassageCredential>? = null,

    /* List of credential types that user has created */
    val webauthnTypes: List<String>? = null


Methods for updating user

Change contact info

To change the user's phone number or email, you can follow the examples below. Note that the user will receive a verification email or text message where they'll need to confirm the change.

suspend fun changePhone(newPhone: String) {
    try {
        val user = passage.getCurrentUser() ?: return
    } catch (e: PassageUserException) {

suspend fun changeEmail(newEmail: String) {
    try {
        val user = passage.getCurrentUser() ?: return
    } catch (e: PassageUserException) {

fun handleUserException(e: PassageUserException) {
    when (e) {
        is PassageUserRequestException -> {
            // User's phone or email was invalid   
        is PassageUserUnauthorizedException -> {
            // User is not authorized to make this change

Manage user passkeys

The following CRUD operations are available for user passkey credentials:

// Create a new passkey

// Get user's device passkeys

// Edit a passkey name
user.editDevicePasskeyName(devicePasskeyId, newName)

// Delete a passkey device
// NOTE: This does NOT remove the passkey from the user's device, but it revokes the passkey

Sign out user

To log out your user and remove their tokens from the PassageTokenStore (more on this in the next section), you can simply call passage.signOutCurrentUser() .

suspend fun signOut() {
    // Go to login screen

Last updated