Hosted Authentication

Register or log in a user using a Passage Hosted Login page

This feature is only available for Android and iOS at the moment.

Passage Hosted Authentication handles user authentication by opening a browser tab for login or sign-up. This simplifies the process, allowing Passage to manage the authentication seamlessly when users need access to your application.

Requirements

Android and iOS platforms each have their own configuration steps required to provide Hosted Login ti your users.

iOS:

iOS Prerequisite: Setup Universal Linking

To register or log in your user, use passage.hostedAuthIOS():

await passage.hostedAuthIOS();

Android:

Android Prerequisite: Setup App Links

Starting Hosted Authorization

To begin registering or logging in a user using a Hosted Authorization, simply call passage.hostedAuthStart(). Here is an example using Hosted Authorization:

await passage.hostedAuthStart()

This will open up a secure web view where the user will be prompted to authorize your app.

Finish Authentication:

When the user has successfully authorized in the web view, they will be redirected into your app where you will receive an authorization code and state. You will use these code and state to finish authentication.

var uri = Uri.parse(link!);
var code = uri.queryParameters['code'];
var state = uri.queryParameters['state'];
await _passage.hostedAuthFinish(code!, state!);

Logout:

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.hostedLogout()

await passage.hostedLogout()

Last updated