Comment on page
How to manage your authenticated user in iOS
Once your user has been authenticated, you can call
passage.getCurrentUser()which will return a
PassageUserInfoinstance. When the user is no longer authenticated, this method will return
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.
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
try? await passage.signOut()