Skip to content

Commit

Permalink
Merge pull request #815 from supertokens/dashboard-changes
Browse files Browse the repository at this point in the history
fix: docs on multitenancy
  • Loading branch information
rishabhpoddar authored Jul 17, 2024
2 parents a5ed213 + 97b9d8f commit 855e0a7
Show file tree
Hide file tree
Showing 33 changed files with 964 additions and 29 deletions.
39 changes: 36 additions & 3 deletions v2/emailpassword/common-customizations/multi-tenancy/multi-app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import MultiTenancyPaidBanner from '../../../community/reusableMD/multitenancy/M
import TabItem from '@theme/TabItem';
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
import CoreInjector from "/src/components/coreInjector"
import CoreVersionSubTabs from "/src/components/tabs/CoreVersionSubTabs";


<!-- COPY DOCS -->
<!-- ./emailpassword/common-customizations/multi-tenancy/multi-app.mdx -->
Expand All @@ -34,19 +36,20 @@ In order to create a new app in the SuperTokens core, you can use the following

<CoreInjector defaultValue="http://localhost:3567" showAppId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/app/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "app1",
"firstFactors": ["emailpassword", "thirdparty", "otp-email", "otp-phone"]
"coreConfig": {...}
}'
```

</CoreInjector>

- The above command will create (or update) an app with the appId of `app1`.
- It will also create a default tenant for this app with the tenant ID of `public` (i.e. the default tenantId)
- You can set various core configs for this app (see the config.yaml / docker env var options for your core). The core configs for a new app will inherit from the the configs provided in the config.yaml / docker env (or our edit config dashboard for managed service).
Expand All @@ -61,6 +64,36 @@ The built-in Factor IDs that can be used for `firstFactors` are:
- With email magic link: `link-email`
- With SMS magic link: `link-phone`

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/app' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"appId": "app1",
"thirdPartyEnabled": true,
"passwordlessEnabled": true,
"emailPasswordEnabled": true,
"coreConfig": {...}
}'
```

- The above command will create (or update) an app with the appId of `app1`.
- It will also create a default tenant for this app with the tenant ID of `public` (i.e. the default tenantId)
- You can set various core configs for this app (see the config.yaml / docker env var options for your core). The core configs for a new app will inherit from the the configs provided in the config.yaml / docker env (or our edit config dashboard for managed service).
- By default, all the login methods are enabled for a new app (specifically, the `public` tenant of the new app), but you can pass in `false` to any of the login methods specified above to disable them.

</TabItem>

</CoreVersionSubTabs>


</CoreInjector>


:::important
Even if a login method is enabled for a tenant, you will still require to initialise the right recipe on the backend for sign up / in to be possible with that login method. For example, if for a tenant, you have enabled the passwordless login method, but don't use the passwordless (or a combination recipe that has passwordless) on the backend, then end users will not be able to sign up / in using the passwordless APIs cause those APIs won't be exposed via our backend SDK's middleware.
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ hide_title: true

import MultiTenancyPaidBanner from '../../../community/reusableMD/multitenancy/MultiTenancyPaidBanner.mdx'
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import PythonSyncAsyncSubTabs from "/src/components/tabs/PythonSyncAsyncSubTabs";
import CoreVersionSubTabs from "/src/components/tabs/CoreVersionSubTabs";
import CoreInjector from "/src/components/coreInjector"

<MultiTenancyPaidBanner />
Expand Down Expand Up @@ -132,6 +134,10 @@ else:

<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
Expand All @@ -142,6 +148,24 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
}'
```

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"emailPasswordEnabled": true
}'
```

</TabItem>

</CoreVersionSubTabs>

</CoreInjector>

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ hide_title: true
---

import MultiTenancyPaidBanner from '../../../community/reusableMD/multitenancy/MultiTenancyPaidBanner.mdx'
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<!-- COPY SECTION -->
<!-- ./emailpassword/custom-ui/multitenant-login.mdx -->
Expand Down
24 changes: 24 additions & 0 deletions v2/emailpassword/custom-ui/multitenant-login.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ hide_title: true
import AppInfoForm from "/src/components/appInfoForm"
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
import PythonSyncAsyncSubTabs from "/src/components/tabs/PythonSyncAsyncSubTabs";
import CoreVersionSubTabs from "/src/components/tabs/CoreVersionSubTabs";
import GoFrameworkSubTabs from "/src/components/tabs/GoFrameworkSubTabs";
import FrontendCustomUITabs from "/src/components/tabs/FrontendCustomUITabs"
import FrontendMobileSubTabs from "/src/components/tabs/FrontendMobileSubTabs"
import NpmOrScriptTabs from "/src/components/tabs/NpmOrScriptTabs"

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import MultiTenancyPaidBanner from '../../community/reusableMD/multitenancy/MultiTenancyPaidBanner.mdx'
import CoreInjector from "/src/components/coreInjector"
Expand Down Expand Up @@ -149,6 +151,10 @@ else:

<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
Expand All @@ -159,6 +165,24 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
}'
```

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"emailPasswordEnabled": true
}'
```

</TabItem>

</CoreVersionSubTabs>

</CoreInjector>

</TabItem>
Expand Down
24 changes: 24 additions & 0 deletions v2/emailpassword/pre-built-ui/multitenant-login.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ hide_title: true
import AppInfoForm from "/src/components/appInfoForm"
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
import PythonSyncAsyncSubTabs from "/src/components/tabs/PythonSyncAsyncSubTabs";
import CoreVersionSubTabs from "/src/components/tabs/CoreVersionSubTabs";
import GoFrameworkSubTabs from "/src/components/tabs/GoFrameworkSubTabs";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import MultiTenancyPaidBanner from '../../community/reusableMD/multitenancy/MultiTenancyPaidBanner.mdx'
import CoreInjector from "/src/components/coreInjector"
Expand Down Expand Up @@ -146,6 +148,10 @@ else:

<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
Expand All @@ -156,6 +162,24 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
}'
```

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"emailPasswordEnabled": true
}'
```

</TabItem>

</CoreVersionSubTabs>

</CoreInjector>

</TabItem>
Expand Down
53 changes: 53 additions & 0 deletions v2/mfa/backend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ hide_title: true

import MFAPaidBanner from '../community/reusableMD/mfa/MFAPaidBanner.mdx'
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import PythonSyncAsyncSubTabs from "/src/components/tabs/PythonSyncAsyncSubTabs";
import CoreVersionSubTabs from "/src/components/tabs/CoreVersionSubTabs";
import CoreInjector from "/src/components/coreInjector"
import CustomAdmonition from "/src/components/customAdmonition"

Expand Down Expand Up @@ -208,6 +210,10 @@ Coming soon. In the meantime, checkout the [legacy method](./legacy-method/how-i

<CoreInjector defaultValue="http://localhost:3567" showAppId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
Expand All @@ -218,6 +224,28 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>
}'
```

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"emailPasswordEnabled": true,
"passwordlessEnabled": true,
"firstFactors": ["emailpassword"]
}'
```

</TabItem>

</CoreVersionSubTabs>



</CoreInjector>

</TabItem>
Expand Down Expand Up @@ -580,6 +608,10 @@ Coming soon. In the meantime, checkout the [legacy method](./legacy-method/how-i

<CoreInjector defaultValue="http://localhost:3567" showAppId={false}>

<CoreVersionSubTabs>

<TabItem value="core-9.1">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant/v2' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
Expand All @@ -591,6 +623,27 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>
}'
```

</TabItem>

<TabItem value="core-9.0">

```bash
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant' \
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"emailPasswordEnabled": true,
"passwordlessEnabled": true,
"firstFactors": ["emailpassword"],
"requiredSecondaryFactors": ["otp-email"]
}'
```

</TabItem>

</CoreVersionSubTabs>

</CoreInjector>

</TabItem>
Expand Down
Loading

0 comments on commit 855e0a7

Please sign in to comment.