Comment on page
User Management
How to manage your authenticated user in iOS
Once your user has been authenticated, you can call
passage.getCurrentUser()
which will return a PassageUserInfo
instance. When the user is no longer authenticated, this method will return nil
.Here's an example:
let passage = PassageAuth(appId: "YOUR_APP_ID")
let user = try? await passage.getCurrentUser()
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.
// Change email for authenticated user
try? await passage.changeEmail(newEmail: "[email protected]");
// Change phone for authenticated user
try? await passage.changePhone(newPhone: "155555555555");
The following CRUD operations are available for user device passkey credentials:
// Create a new device passkey
let newDevicePasskey = try? await passage.addDevice()
// Get user's device passkeys
let devicePasskeys = try? await passage.listDevices()
// Edit a device passkey name
let id = "XXXXXXXXXXXXXX"
let newName = "My favorite passkey"
try? await passage.editDevice(deviceId: id, friendlyName: newName)
// Revoke a device passkey
// NOTE: This does NOT remove the passkey from the user's device, but it revokes the passkey
try? await passage.revokeDevice(deviceId: id)
To log out your user and remove their tokens from the
TokenStore
(more on this in the next section), you can simply call passage.signOut()
.try? await passage.signOut()
Last modified 4d ago