Configure Native to Web SSO
Native to Web SSO supports the following SDKs: Auth0 Android SDK and Auth0 Swift SDK.Native to Web SSO support is available in the following tools: Auth0 Deploy CLI. Auth0 Terraform Provider and Auth0 CLI.Native to Web SSO supports any authentication flow that returns a refresh token, such as Resource Owner Password Flow and Authorization Code Flow with Proof Key for Code Exchange.
Create and manage Session Transfer Tokens
- Create and manage
session_transfer_tokens - Create sessions in a web browser via cookies or a URL parameter
- Bind the session to a user’s device through an IP address or ASN
PATCH call to the Update a Client endpoint. To create a new application, make a POST call to the Create a Client endpoint:
Configure native applications
- Update your native application using your Management API with the Update a Client endpoint:
- Update your native application using Auth0 CLI:
Configure web applications
- Update your web application using the Management API Access Token with the Update a Client endpoint:
- Update your web application using Auth0 CLI:
Implement Native to Web SSO
If
allow_refresh_token is disabled in the client but the application requests offline_access, Auth0 will not issue a refresh_token but the authentication will still work.If refresh token rotation is enabled, Auth0 returns a new refresh_token in the token exchange call. The refresh token exchange should happen immediately before your code opens the web application.In your native application
Step 1: Exchanging a Refresh Token for a Session Transfer Token
- Exchange a refresh token for a session transfer token using Swift or Android SDKs:
- Swift SDK
- Android SDK
- Exchange a refresh token for a session transfer token using HTTP:
These samples use placeholder variables for dynamic variables. Replace the placeholders using your Auth0 domain, client_id and an existing refresh_token.
If refresh token rotation is enabled, the exchange will also return a refresh token.If you requested an ID Token during authentication, this call will also return an ID Token.
session_transfer_token to your web application based on the configured allowed_authentication_methods.
If your web application using WebView or browser supports cookie injection, you can configure your native application to:
- Add the session_transfer_token into a cookie.
- Open the web application using WebView or browser.
- Log the web application to your Auth0 tenant or . As the
session_transfer_tokenis included in the cookie, the user is not prompted for first-factor authentication.
Option 2: Send the session_transfer_token as a URL parameter
- Add the session_transfer_token as a URL parameter.
- Open the web application using WebView or browser.
- Log the web application appending the
session_transfer_tokenas a URL parameter to the /authorize endpoint. The Auth0 tenant authenticates the user without requiring first-factor authentication, as the session_transfer_token is valid and trusted
In your web application
When the Session Transfer Token is sent as a cookie, no further configuration is needed as the browser sends the cookie in the
/authorize endpoint request.Option 1: Add the Session Transfer Token in your web application request
/authorize endpoint when the session_transfer_token is sent as a URL parameter.
Option 2: Add the Session Transfer Token to web applications using Auth0 SDKs
session_transfer_token in the /authorize endpoint request.
Below are examples of web applications using Auth0 SDKs to redirect the session_transfer_token in the /authorize endpoint request:
Node (Express.js)
session_transfer_token.
javascript
SAML and WS-Federation
session_transfer_token as an URL parameter to the Auth0 /authorize endpoint and the redirect_uri is the SAML or WS-Fed sign-in URL.
Session Transfer Token with Actions
session_transfer_token with Actions allows you to configure post-authentication risk detection and response capabilities to enhance user protection.
To facilitate this, the post-login Action object event.session_transfer_token provides relevant information including unique client_id, scope, request information such as ip, asn, user_agent and geoip information such as, cityName, countryCode among others. To learn more, read Actions Triggers: post-login - Event Object.
The Action code below allows you to dynamically reject a transaction based on geolocation information:
javascript
Monitoring
sertft: Successful Refresh Token exchange. This log will correspond to a Native to Web SSO exchange when theaudiencefield is"audience":"urn:$auth0Domain:session_transfer"fertft: Failed Refresh Token exchange. This log will correspond to a Native to Web SSO exchange when theaudiencefield is"audience": "urn:$auth0Domain:session_transfer"