Skip to content

Commit

Permalink
Add redirect routes and link fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbogdan committed Nov 19, 2024
1 parent 9e7fe46 commit 6b9bc34
Show file tree
Hide file tree
Showing 189 changed files with 5,403 additions and 70,917 deletions.
1,200 changes: 1,196 additions & 4 deletions v2/emailpassword/common-customizations/email-verification/about.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,158 +26,6 @@ The configuration mapped to each tenant contains information about which login m
<!-- COPY SECTION -->
<!-- ./emailpassword/custom-ui/multitenant-login.mdx -->
<!-- 2a -->

<BackendSDKTabs enableCurl enableDashboard>

<TabItem value="nodejs">

```tsx
import Multitenancy from "supertokens-node/recipe/multitenancy";

async function createNewTenant() {

// highlight-start
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
firstFactors: ["emailpassword"]
});
// highlight-end

if (resp.createdNew) {
// new tenant was created
} else {
// existing tenant's config was modified.
}
}
```

</TabItem>
<TabItem value="go">

```go
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/multitenancy/multitenancymodels"
)

func main() {
tenantId := "customer1"
emailPasswordEnabled := true

// highlight-start
resp, err := multitenancy.CreateOrUpdateTenant(tenantId, multitenancymodels.TenantConfig{
EmailPasswordEnabled: &emailPasswordEnabled,
})
// highlight-end

if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// new tenant was created
} else {
// existing tenant's config was modified.
}
}
```

</TabItem>
<TabItem value="python">

<PythonSyncAsyncSubTabs>
<TabItem value="asyncio">

```python
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_tenant
from supertokens_python.recipe.multitenancy.interfaces import TenantConfigCreateOrUpdate

async def some_func():
tenant_id = "customer1"
result = await create_or_update_tenant(tenant_id, TenantConfigCreateOrUpdate(
first_factors=["emailpassword"]
))

if result.status != "OK":
print("handle error")
elif result.created_new:
print("new tenant created")
else:
print("existing tenant's config was modified.")
```

</TabItem>

<TabItem value="syncio">

```python
from supertokens_python.recipe.multitenancy.syncio import create_or_update_tenant
from supertokens_python.recipe.multitenancy.interfaces import TenantConfigCreateOrUpdate

tenant_id = "customer1"
result = create_or_update_tenant(tenant_id, TenantConfigCreateOrUpdate(
first_factors=["emailpassword"]
))

if result.status != "OK":
print("handle error")
elif result.created_new:
print("new tenant created")
else:
print("existing tenant's config was modified.")
```

</TabItem>
</PythonSyncAsyncSubTabs>

</TabItem>

<TabItem value="curl">

<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}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tenantId": "customer1",
"firstFactors": ["emailpassword"]
}'
```

</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>

<TabItem value="dashboard">

<img src="/img/dashboard/tenant-management/ep-create-tenant.gif" alt="Create Tenant"/>

</TabItem>

</BackendSDKTabs>

<!-- END COPY SECTION -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ import TabItem from '@theme/TabItem';
<!-- COPY SECTION -->
<!-- ./emailpassword/custom-ui/multitenant-login.mdx -->
<!-- 1 -->

<MultiTenancyPaidBanner />

# Multitenant login

Multitenant login is a feature that lets you customize the login experience for each of your customers. For example, a customer `customer1` hosted on `customer1.yourdomain.com` can have login with email password (using this recipe), and another customer `customer2` hosted on `customer2.yourdomain.com` can have login with `Active Directory` and `Facebook` (using the thirdparty recipe).

<!-- END COPY SECTION -->

## Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,133 +291,6 @@ async function shouldLoadRoute(): Promise<boolean> {
<!-- COPY SECTION -->
<!-- ./thirdpartyemailpassword/custom-ui/securing-routes.mdx -->
<!-- 3 -->


<FrontendCustomUITabs>
<TabItem value="web">

<NpmOrScriptTabs>
<TabItem value="npm">

You can use the `doesSessionExist` function to check if a session exists.

```tsx
import Session from 'supertokens-web-js/recipe/session';

async function doesSessionExist() {
if (await Session.doesSessionExist()) {
// user is logged in
} else {
// user has not logged in yet
}
}
```

</TabItem>
<TabItem value="script">

You can use the `doesSessionExist` function to check if a session exists.

```tsx
import Session from 'supertokens-web-js-script/recipe/session';
async function doesSessionExist() {
if (await Session.doesSessionExist()) {
// user is logged in
} else {
// user has not logged in yet
}
}
```

</TabItem>
</NpmOrScriptTabs>

</TabItem>

<TabItem value="mobile">

<FrontendMobileSubTabs>

<TabItem value="reactnative">

You can use the `doesSessionExist` function to check if a session exists.

```tsx
import SuperTokens from 'supertokens-react-native';

async function doesSessionExist() {
if (await SuperTokens.doesSessionExist()) {
// user is logged in
} else {
// user has not logged in yet
}
}
```

</TabItem>

<TabItem value="android">

You can use the `doesSessionExist` function to check if a session exists.

```kotlin
import android.app.Application
import com.supertokens.session.SuperTokens

class MainApplication: Application() {
fun doesSessionExist() {
if (SuperTokens.doesSessionExist(this.applicationContext)) {
// user is logged in
} else {
// user has not logged in yet
}
}
}
```

</TabItem>

<TabItem value="ios">

You can use the `doesSessionExist` function to check if a session exists.

```swift
import UIKit
import SuperTokensIOS

fileprivate class ViewController: UIViewController {
func doesSessionExist() {
if SuperTokens.doesSessionExist() {
// User is logged in
} else {
// User is not logged in
}
}
}
```

</TabItem>

<TabItem value="flutter">

You can use the `doesSessionExist` function to check if a session exists.

```dart
import 'package:supertokens_flutter/supertokens.dart';
Future<bool> doesSessionExist() async {
return await SuperTokens.doesSessionExist();
}
```

</TabItem>

</FrontendMobileSubTabs>

</TabItem>

</FrontendCustomUITabs>

<!-- END COPY SECTION -->

## Verifying the claims of a session
Expand Down
Loading

0 comments on commit 6b9bc34

Please sign in to comment.