session_transfer_token
.
The sections below outline how you can add:
session_transfer_token
whether through a URL parameter or cookie can be adapted accordingly.session_transfer_token
to establish SSO from a native to a web application. The session_transfer_token
allows Auth0 to identify the user, the origin native application, and additional context securely. To learn more, read Native to Web SSO.
Enable Native to Web SSO using Auth0 CLI:
session_transfer_token
for authentication through a cookie or URL parameter using Auth0 CLI:
session_transfer_token
is injected into the browser with a cookie no additional changes to your web application are required. The only requirement is that the browser navigates to your application’s Login URI to handle the redirect of the user to your Auth0 tenant’s /authorize
endpoint.
/src/views/
file to create a subscription page:
src/views/JoinMembership.js
. This file will prompt the users to complete a paid subscription.
src/App.js
and add a /join-membership
route to the new subscription page:
/join-membership
route:
session_transfer_token
is appended as a URL parameter, the token is passed in the authentication request.session_transfer_token
, it will be included in the login request to Auth0./join-membership
page to select the subscription options.refresh_token
for a session_transfer_token
immediately before launching the web application. To do so, add the session transfer exchange and the web application launch logic inside the same event handler, an example is the button’s onClick
method.
Subscribe to Membership
button to the ProfileView.swift
file.
Edit the body of the ProfileView.swift
file to include a button below the user information:
ProfileView.swift
file adds a Subscribe to Membership
button and uses an onSubscribe
closure to determine the behavior when selected.
MainView.swift
file to define the behavior of the Subscribe to Membership
button:
https://sample.api.com
for demonstration purposes. You can create an API with this identifier in your Auth0 tenant or replace it with your own API identifier.To learn more, read Set Up APIs.Subscribe to Membership
in the native app and immediately start the web application subscription process without logging in again.
Subscribe to Membership
button to the UI.
Edit the MainActivity.kt
file and add the following code to the onCreate()
method:
activity_main.xml
file to include the code below after @+id/button\_patch\_metadata
button:
MainActivity.kt
file to define the behavior of the Subscribe to Membership
button:
onCreate()
method to include the credentialsManager:
loginwithBrowser()
method to store credentials using the credentialsManager:
https://sample.api.com
for demonstration purposes. You can create an API with this identifier in your Auth0 tenant or replace it with your own API identifier.To learn more, read Set Up APIs.launchSubscriptionFlow()
method to open the web application:Subscribe to Membership
in the native application and immediately start the web application subscription process without logging in again.
refresh_token
is used to request a secure session_transfer_token
session_transfer_token
is injected into a cookie for your Auth0 domainWKWebView
is used to load your web application’s /join-membership
routesession_transfer_token
and completes login using Native to Web SSO