Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.

Which UI do you use?
Custom UI
Pre built UI

Share sessions across sub domains

Sharing sessions across multiple sub domains in SuperTokens can be configured by setting the sessionTokenFrontendDomain attribute of the Session recipe in your frontend code.


  • Your app has two subdomains and We assume that the user logs in via
  • To enable sharing sessions across, and the sessionTokenFrontendDomain attribute must be set to or
import SuperTokens from "supertokens-auth-react";
import Session from "supertokens-auth-react/recipe/session";

appInfo: {
// ...
// this should be equal to the domain where the user will see the login UI
apiDomain: "...",
appName: "...",
websiteDomain: ""
recipeList: [
sessionTokenFrontendDomain: "" // or "" (they both work)
  • Do not set sessionTokenFrontendDomain to a value that's in the public suffix list (Search for your value without the leading dot). Otherwise session management will not work.
  • Do not set sessionTokenFrontendDomain to .localhost or an IP address based domain with a leading . since browsers will reject these cookies. For local development, you should configure your machine to use alias for localhost.
Multi Tenancy

In case you have a setup where each tenant belongs to one sub domain, and if a user has access to more than one tenant, the tenant ID as seen in the session will always be the one from which they logged into.

For example, if you a user has access to tenant and, and they logged in via, then the tenant ID in the session will always be t1 even if they navigate to, or make an API request from

To solve this, you can add extra information about access token payload containing a list of all the tenants that the user has access to, and then read from that list instead of the tId claim.

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI