Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/quickstart/backend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@
</BackendTabs.TabItem>
</BackendTabs>


:::info Multiple frontend domains
To handle clients from different domains with the same SuperTokens instance, use the `origin` property in the `appInfo` object instead of `websiteDomain`.
The property accepts a function that receives the original request as an input and should return a valid domain.
Make sure to whitelist all the domains during CORS configuration.

Keep in mind that with this setup, each frontend application will not share authentication sessions.

Check warning on line 119 in docs/quickstart/backend-setup.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.tense] Avoid temporal words like 'will'. Raw Output: {"message": "[SuperTokens.tense] Avoid temporal words like 'will'.", "location": {"path": "docs/quickstart/backend-setup.mdx", "range": {"start": {"line": 119, "column": 62}}}, "severity": "WARNING"}
Users will have to authenticate separately for each domain.

Check warning on line 120 in docs/quickstart/backend-setup.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.adjectives] Remove 'separately' if it's not important to the meaning of the statement. Raw Output: {"message": "[SuperTokens.adjectives] Remove 'separately' if it's not important to the meaning of the statement.", "location": {"path": "docs/quickstart/backend-setup.mdx", "range": {"start": {"line": 120, "column": 33}}}, "severity": "WARNING"}

Check warning on line 120 in docs/quickstart/backend-setup.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.tense] Avoid temporal words like 'will'. Raw Output: {"message": "[SuperTokens.tense] Avoid temporal words like 'will'.", "location": {"path": "docs/quickstart/backend-setup.mdx", "range": {"start": {"line": 120, "column": 7}}}, "severity": "WARNING"}
To configure a shared authentication experiece between multiple services check the [Unified Login](/docs/authentication/unified-login/introduction) documentation.

Check failure on line 121 in docs/quickstart/backend-setup.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.spelling] This word is not recognized: 'experiece' Raw Output: {"message": "[SuperTokens.spelling] This word is not recognized: 'experiece'", "location": {"path": "docs/quickstart/backend-setup.mdx", "range": {"start": {"line": 121, "column": 38}}}, "severity": "ERROR"}
:::


## 3. Add the SuperTokens APIs and Configure CORS

Now that the SDK is initialized you need to expose the endpoints that will be used by the frontend SDKs.
Expand Down
10 changes: 9 additions & 1 deletion docs/references/backend-sdks/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ The `appInfo` object is the paramter used to configure the SDKs during initializ
```ts
let appInfo: {
appName: string,
websiteDomain: string,
apiDomain: string,
websiteDomain?: string,
websiteBasePath?: string,
origin?: ((input: { request?: Request; userContext: UserContext }) => string) | string,
apiBasePath?: string,
apiGatewayPath?: string
}
Expand Down Expand Up @@ -133,6 +134,13 @@ Remember to set the same value for this parameter on the backend and the fronten

<br/>

## `origin`

Can be used instead of `websiteDomain` to handle multiple frontend domains within the same SuperTokens instance.
The property accepts a function that receives the original request as an input and should return a valid domain.
Make sure to whitelist all the domains during CORS configuration.

<br/>

## `apiBasePath`

Expand Down