Skip to content

Commit 8eb53a5

Browse files
authored
Merge pull request #1048 from supertokens/feat/tenant-management-docs
Add information about the origin property
2 parents 5d5cda3 + c32d7b6 commit 8eb53a5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

docs/quickstart/backend-setup.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ The init call will include [configuration details](/docs/references/backend-sdks
110110
</BackendTabs.TabItem>
111111
</BackendTabs>
112112

113+
114+
:::info Multiple frontend domains
115+
To handle clients from different domains with the same SuperTokens instance, use the `origin` property in the `appInfo` object instead of `websiteDomain`.
116+
The property accepts a function that receives the original request as an input and should return a valid domain.
117+
Make sure to whitelist all the domains during CORS configuration.
118+
119+
Keep in mind that with this setup, each frontend application will not share authentication sessions.
120+
Users will have to authenticate separately for each domain.
121+
To configure a shared authentication experiece between multiple services check the [Unified Login](/docs/authentication/unified-login/introduction) documentation.
122+
:::
123+
124+
113125
## 3. Add the SuperTokens APIs and Configure CORS
114126

115127
Now that the SDK is initialized you need to expose the endpoints that will be used by the frontend SDKs.

docs/references/backend-sdks/reference.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ The `appInfo` object is the paramter used to configure the SDKs during initializ
7474
```ts
7575
let appInfo: {
7676
appName: string,
77-
websiteDomain: string,
7877
apiDomain: string,
78+
websiteDomain?: string,
7979
websiteBasePath?: string,
80+
origin?: ((input: { request?: Request; userContext: UserContext }) => string) | string,
8081
apiBasePath?: string,
8182
apiGatewayPath?: string
8283
}
@@ -133,6 +134,13 @@ Remember to set the same value for this parameter on the backend and the fronten
133134

134135
<br/>
135136

137+
## `origin`
138+
139+
Can be used instead of `websiteDomain` to handle multiple frontend domains within the same SuperTokens instance.
140+
The property accepts a function that receives the original request as an input and should return a valid domain.
141+
Make sure to whitelist all the domains during CORS configuration.
142+
143+
<br/>
136144

137145
## `apiBasePath`
138146

0 commit comments

Comments
 (0)