Built in provider config
Below is a list of all built in providers for single or multi tenant login / SSO.
#
Google- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "google",
clients: [{
clientId: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
clientSecret: "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",
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="google",
clients=[
ProviderClientConfig(
client_id="1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
client_secret="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",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "google",
name: "Google",
clients: [{
clientId: "...",
clientSecret: "..."
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "google",
Name: "Google",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="google",
name="Google",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="google",
name="Google",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "google",
"name": "Google",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "google",
"name": "Google",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
#
Google Workspaces- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "google-workspaces",
clients: [{
clientId: "TODO",
clientSecret: "TODO",
additionalConfig: {
"hd": "example.com"
}
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google-workspaces",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
AdditionalConfig: map[string]interface{}{
"hd": "example.com",
},
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="google-workspaces",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
additional_config={
"hd": "example.com",
},
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "google-workspaces",
name: "Google Workspaces",
clients: [{
clientId: "...",
clientSecret: "...",
additionalConfig: {
"hd": "example.com",
}
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "google-workspaces",
Name: "Google Workspaces",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
AdditionalConfig: map[string]interface{}{
"hd": "example.com",
},
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="google-workspaces",
name="Google Workspaces",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
additional_config={
"hd": "example.com",
},
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="google-workspaces",
name="Google Workspaces",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
additional_config={
"hd": "example.com",
},
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "google-workspaces",
"name": "Google Workspaces",
"clients": [
{
"clientId": "...",
"clientSecret": "...",
"additionalConfig": {
"hd": "example.com"
}
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "google-workspaces",
"name": "Google Workspaces",
"clients": [
{
"clientId": "...",
"clientSecret": "...",
"additionalConfig": {
"hd": "example.com"
}
}
]
}
}'
#
Apple- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "apple",
clients: [{
clientId: "4398792-io.supertokens.example.service",
additionalConfig: {
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
},
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "apple",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "4398792-io.supertokens.example.service",
AdditionalConfig: map[string]interface{}{
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
},
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="apple",
clients=[
ProviderClientConfig(
client_id="4398792-io.supertokens.example.service",
additional_config={
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
},
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "apple",
name: "Apple",
clients: [{
clientId: "...",
additionalConfig: {
"keyId": "...",
"privateKey": "...",
"teamId": "...",
}
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "apple",
Name: "Apple",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
AdditionalConfig: map[string]interface{}{
"keyId": "...",
"privateKey": "...",
"teamId": "...",
},
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="apple",
name="Apple",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
additional_config={
"keyId": "...",
"privateKey": "...",
"teamId": "...",
},
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="apple",
name="Apple",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
additional_config={
"keyId": "...",
"privateKey": "...",
"teamId": "...",
},
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "apple",
"name": "Apple",
"clients": [
{
"clientId": "...",
"additionalConfig": {
"keyId": "...",
"privateKey": "...",
"teamId": "..."
}
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "apple",
"name": "Apple",
"clients": [
{
"clientId": "...",
"additionalConfig": {
"keyId": "...",
"privateKey": "...",
"teamId": "..."
}
}
]
}
}'
#
Discord- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "discord",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "discord",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="discord",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "discord",
name: "Discord",
clients: [{
clientId: "...",
clientSecret: "...",
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "discord",
Name: "Discord",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="discord",
name="Discord",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="discord",
name="Discord",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "discord",
"name": "Discord",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "discord",
"name": "Discord",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
#
Facebook- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "facebook",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "facebook",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="facebook",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "facebook",
name: "Facebook",
clients: [{
clientId: "...",
clientSecret: "...",
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "facebook",
Name: "Facebook",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="facebook",
name="Facebook",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="facebook",
name="Facebook",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "facebook",
"name": "Facebook",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "facebook",
"name": "Facebook",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
#
Github- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "github",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "github",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="github",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "github",
name: "GitHub",
clients: [{
clientId: "...",
clientSecret: "...",
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "github",
Name: "GitHub",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="github",
name="GitHub",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="github",
name="GitHub",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "github",
"name": "GitHub",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
curl --location --request PUT '/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "github",
"name": "GitHub",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
#
LinkedIn- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "linkedin",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "linkedin",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="linkedin",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "linkedin",
name: "LinkedIn",
clients: [{
clientId: "...",
clientSecret: "...",
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "linkedin",
Name: "LinkedIn",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="linkedin",
name="LinkedIn",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="linkedin",
name="LinkedIn",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "linkedin",
"name": "LinkedIn",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "linkedin",
"name": "LinkedIn",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
]
}
}'
#
Twitter- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "twitter",
clients: [{
clientId: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
clientSecret: "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC"
}]
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "twitter",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
ClientSecret: "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="twitter",
clients=[
ProviderClientConfig(
client_id="4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
client_secret="BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "twitter",
name: "Twitter",
clients: [{
clientId: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
clientSecret: "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
}]
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "twitter",
Name: "Twitter",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
ClientSecret: "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="twitter",
name="Twitter",
clients=[
ProviderClientConfig(
client_id="4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
client_secret="BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="twitter",
name="Twitter",
clients=[
ProviderClientConfig(
client_id="4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
client_secret="BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "twitter",
"name": "Twitter",
"clients": [
{
"clientId": "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
"clientSecret": "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC"
}
]
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "twitter",
"name": "Twitter",
"clients": [
{
"clientId": "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ",
"clientSecret": "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC"
}
]
}
}'
#
Active Directory- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "active-directory",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}],
oidcDiscoveryEndpoint: "https://login.microsoftonline.com/<directoryId>/v2.0",
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "active-directory",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
OIDCDiscoveryEndpoint: "https://login.microsoftonline.com/<directoryId>/v2.0",
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="active-directory",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
oidc_discovery_endpoint="https://login.microsoftonline.com/<directoryId>/v2.0",
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "active-directory",
name: "Active Directory",
clients: [{
clientId: "...",
clientSecret: "...",
}],
oidcDiscoveryEndpoint: "https://login.microsoftonline.com/<directoryId>/v2.0",
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "active-directory",
Name: "Active Directory",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
OIDCDiscoveryEndpoint: "https://login.microsoftonline.com/<directoryId>/v2.0",
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="active-directory",
name="Active Directoy",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
oidc_discovery_endpoint="https://login.microsoftonline.com/<directoryId>/v2.0",
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="active-directory",
name="Active Directoy",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
oidc_discovery_endpoint="https://login.microsoftonline.com/<directoryId>/v2.0",
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "active-directory",
"name": "Active Directory",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
"oidcDiscoveryEndpoint": "https://login.microsoftonline.com/<directoryId>/v2.0"
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "active-directory",
"name": "Active Directory",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
"oidcDiscoveryEndpoint": "https://login.microsoftonline.com/<directoryId>/v2.0"
}
}'
#
Okta- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "okta",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}],
oidcDiscoveryEndpoint: "https://dev-<id>.okta.com",
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "okta",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
OIDCDiscoveryEndpoint: "https://dev-<id>.okta.com",
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="okta",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
oidc_discovery_endpoint="https://dev-<id>.okta.com",
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "okta",
name: "Okta",
clients: [{
clientId: "...",
clientSecret: "...",
}],
oidcDiscoveryEndpoint: "https://dev-<id>.okta.com",
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "okta",
Name: "Okta",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
OIDCDiscoveryEndpoint: "https://dev-<id>.okta.com",
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="okta",
name="Okta",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
oidc_discovery_endpoint="https://dev-<id>.okta.com",
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="okta",
name="Okta",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
oidc_discovery_endpoint="https://dev-<id>.okta.com",
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "okta",
"name": "Okta",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
"oidcDiscoveryEndpoint": "https://dev-<id>.okta.com"
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "okta",
"name": "Okta",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
"oidcDiscoveryEndpoint": "https://dev-<id>.okta.com"
}
}'
#
Bitbucket- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "bitbucket",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}],
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "bitbucket",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="bitbucket",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "bitbucket",
name: "Bitbucket",
clients: [{
clientId: "...",
clientSecret: "...",
}],
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
import (
"github.com/supertokens/supertokens-golang/recipe/multitenancy"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
)
func main() {
tenantId := "customer1"
resp, err := multitenancy.CreateOrUpdateThirdPartyConfig(tenantId, tpmodels.ProviderConfig{
ThirdPartyId: "bitbucket",
Name: "Bitbucket",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "...",
ClientSecret: "...",
},
},
}, nil)
if err != nil {
// handle error
}
if resp.OK.CreatedNew {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}
- Asyncio
- Syncio
from supertokens_python.recipe.multitenancy.asyncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
async def some_func():
tenant_id = "customer1"
result = await create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="bitbucket",
name="Bitbucket",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
from supertokens_python.recipe.multitenancy.syncio import create_or_update_third_party_config
from supertokens_python.recipe.thirdparty.provider import ProviderConfig, ProviderClientConfig
tenant_id = "customer1"
result = create_or_update_third_party_config(tenant_id, ProviderConfig(
third_party_id="bitbucket",
name="Bitbucket",
clients=[
ProviderClientConfig(
client_id="...",
client_secret="...",
),
],
))
if result.status != "OK":
print("handle error")
elif result.created_new:
print("Provider added to customer1")
else:
print("Existing provider config overwritten for customer1")
- Single app setup
- Multi app setup
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "bitbucket",
"name": "Bitbucket",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
}
}'
curl --location --request PUT '/<TENANT_ID>/recipe/multitenancy/config/thirdparty' \
--header 'api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"thirdPartyId": "bitbucket",
"name": "Bitbucket",
"clients": [
{
"clientId": "...",
"clientSecret": "..."
}
],
}
}'
#
GitLab- Single Tenant
- Multi Tenant
- NodeJS
- GoLang
- Python
- Other Frameworks
Important
import SuperTokens from "supertokens-node";
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
supertokens: {
connectionURI: "...",
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
{
config: {
thirdPartyId: "gitlab",
clients: [{
clientId: "TODO",
clientSecret: "TODO"
}],
oidcDiscoveryEndpoint: "https://gitlab.example.com",
}
}
]
}), // initializes signin / sign up features
]
});
import (
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
supertokens.Init(supertokens.TypeInput{
RecipeList: []supertokens.Recipe{
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "gitlab",
Clients: []tpmodels.ProviderClientConfig{
{
ClientID: "TODO:",
ClientSecret: "TODO:",
},
},
OIDCDiscoveryEndpoint: "https://gitlab.example.com",
},
},
},
}),
},
})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import thirdpartyemailpassword
from supertokens_python.recipe.thirdparty import ProviderInput, ProviderConfig, ProviderClientConfig
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
thirdpartyemailpassword.init(
providers=[
ProviderInput(
config=ProviderConfig(
third_party_id="gitlab",
clients=[
ProviderClientConfig(
client_id="TODO:",
client_secret="TODO:",
),
],
oidc_discovery_endpoint="https://gitlab.example.com"
),
),
]
)
]
)
Call the following function / API to add the third party provider to a specific tenant.
- NodeJS
- GoLang
- Python
- cURL
Important
import Multitenancy from "supertokens-node/recipe/multitenancy";
async function addThirdPartyToTenant() {
let resp = await Multitenancy.createOrUpdateThirdPartyConfig("customer1", {
thirdPartyId: "gitlab",
name: "GitLab",
clients: [{
clientId: "...",
clientSecret: "...",
}],
oidcDiscoveryEndpoint: "https://gitlab.example.com",
});
if (resp.createdNew) {
// Provider added to customer1
} else {
// Existing provider config overwritten for customer1
}
}