Hosted Authentication
Register or log in a user using a Passage Hosted Login page
Using Hosted Authentication is the fastest and easiest way to get your iOS app setup with Passage and passkeys. When you create your Passage App in the Passage Console, you'll need to select "Hosted Login" from the app creation options. Learn how to configure your iOS app
NOTE: Passage Hosted Authentication is currently not available for macOS, tvOS, watchOS, or visionOS.
Authenticate user with Hosted Auth
To register or log in your user, use passage.hosted.authorize()
:
do {
try await passage.passage.hosted.authorize()
// Do authenticated stuff
} catch HostedAuthorizationError.canceled {
// User canceled authentication flow.
} catch {
// An unexpected error occurred.
}
Log out user
The secure hosted web view will keep your auth session until it expires. To clear the web view auth session and remove user's tokens from device, use passage.currentUser.logOut
:
do {
try await passage.currentUser.logOut()
} catch {
// An unexpected error occurred.
}