Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

supertokens-node/recipe/multitenancy

References documentation for the supertokens-node/recipe/multitenancy package

Classes

default

Defined in: recipe/multitenancy/index.ts

Constructors

Constructor
new default(): default;
Returns

default

Properties

Property Modifier Type Default value Defined in
init static (config?) => RecipeListFunction Recipe.init recipe/multitenancy/index.ts

Methods

associateUserToTenant()
static associateUserToTenant(
   tenantId, 
   recipeUserId, 
   userContext?): Promise<
  | {
  status: "OK";
  wasAlreadyAssociated: boolean;
}
  | {
  status:   | "EMAIL_ALREADY_EXISTS_ERROR"
     | "UNKNOWN_USER_ID_ERROR"
     | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"
     | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR";
}
  | {
  reason: string;
  status: "ASSOCIATION_NOT_ALLOWED_ERROR";
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
recipeUserId RecipeUserId
userContext? Record<string, any>
Returns

Promise< | { status: "OK"; wasAlreadyAssociated: boolean; } | { status: | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; } | { reason: string; status: "ASSOCIATION_NOT_ALLOWED_ERROR"; }>

createOrUpdateTenant()
static createOrUpdateTenant(
   tenantId, 
   config?, 
   userContext?): Promise<{
  createdNew: boolean;
  status: "OK";
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
config? { coreConfig?: { [key: string]: any; }; firstFactors?: string[]; requiredSecondaryFactors?: string[]; }
config.coreConfig? { [key: string]: any; }
config.firstFactors? string[]
config.requiredSecondaryFactors? string[]
userContext? Record<string, any>
Returns

Promise<{ createdNew: boolean; status: "OK"; }>

createOrUpdateThirdPartyConfig()
static createOrUpdateThirdPartyConfig(
   tenantId, 
   config, 
   skipValidation?, 
   userContext?): Promise<{
  createdNew: boolean;
  status: "OK";
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
config ProviderConfig
skipValidation? boolean
userContext? Record<string, any>
Returns

Promise<{ createdNew: boolean; status: "OK"; }>

deleteTenant()
static deleteTenant(tenantId, userContext?): Promise<{
  didExist: boolean;
  status: "OK";
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
userContext? Record<string, any>
Returns

Promise<{ didExist: boolean; status: "OK"; }>

deleteThirdPartyConfig()
static deleteThirdPartyConfig(
   tenantId, 
   thirdPartyId, 
   userContext?): Promise<{
  didConfigExist: boolean;
  status: "OK";
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
thirdPartyId string
userContext? Record<string, any>
Returns

Promise<{ didConfigExist: boolean; status: "OK"; }>

disassociateUserFromTenant()
static disassociateUserFromTenant(
   tenantId, 
   recipeUserId, 
   userContext?): Promise<{
  status: "OK";
  wasAssociated: boolean;
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
recipeUserId RecipeUserId
userContext? Record<string, any>
Returns

Promise<{ status: "OK"; wasAssociated: boolean; }>

getTenant()
static getTenant(tenantId, userContext?): Promise<object & TenantConfig>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
tenantId string
userContext? Record<string, any>
Returns

Promise<object & TenantConfig>

listAllTenants()
static listAllTenants(userContext?): Promise<{
  status: "OK";
  tenants: object & TenantConfig[];
}>;

Defined in: recipe/multitenancy/index.ts

Parameters
Parameter Type
userContext? Record<string, any>
Returns

Promise<{ status: "OK"; tenants: object & TenantConfig[]; }>

Variables

AllowedDomainsClaim

const AllowedDomainsClaim: AllowedDomainsClaimClass;

Defined in: recipe/multitenancy/allowedDomainsClaim.ts


associateUserToTenant()

associateUserToTenant: (tenantId, recipeUserId, userContext?) => Promise<
  | {
  status: "OK";
  wasAlreadyAssociated: boolean;
}
  | {
  status:   | "EMAIL_ALREADY_EXISTS_ERROR"
     | "UNKNOWN_USER_ID_ERROR"
     | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"
     | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR";
}
  | {
  reason: string;
  status: "ASSOCIATION_NOT_ALLOWED_ERROR";
}> = Wrapper.associateUserToTenant;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
recipeUserId RecipeUserId
userContext? Record<string, any>

Returns

Promise< | { status: "OK"; wasAlreadyAssociated: boolean; } | { status: | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; } | { reason: string; status: "ASSOCIATION_NOT_ALLOWED_ERROR"; }>


createOrUpdateTenant()

createOrUpdateTenant: (tenantId, config?, userContext?) => Promise<{
  createdNew: boolean;
  status: "OK";
}> = Wrapper.createOrUpdateTenant;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
config? { coreConfig?: { [key: string]: any; }; firstFactors?: string[]; requiredSecondaryFactors?: string[]; }
config.coreConfig? { [key: string]: any; }
config.firstFactors? string[]
config.requiredSecondaryFactors? string[]
userContext? Record<string, any>

Returns

Promise<{ createdNew: boolean; status: "OK"; }>


createOrUpdateThirdPartyConfig()

createOrUpdateThirdPartyConfig: (tenantId, config, skipValidation?, userContext?) => Promise<{
  createdNew: boolean;
  status: "OK";
}> = Wrapper.createOrUpdateThirdPartyConfig;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
config ProviderConfig
skipValidation? boolean
userContext? Record<string, any>

Returns

Promise<{ createdNew: boolean; status: "OK"; }>


deleteTenant()

deleteTenant: (tenantId, userContext?) => Promise<{
  didExist: boolean;
  status: "OK";
}> = Wrapper.deleteTenant;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
userContext? Record<string, any>

Returns

Promise<{ didExist: boolean; status: "OK"; }>


deleteThirdPartyConfig()

deleteThirdPartyConfig: (tenantId, thirdPartyId, userContext?) => Promise<{
  didConfigExist: boolean;
  status: "OK";
}> = Wrapper.deleteThirdPartyConfig;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
thirdPartyId string
userContext? Record<string, any>

Returns

Promise<{ didConfigExist: boolean; status: "OK"; }>


disassociateUserFromTenant()

disassociateUserFromTenant: (tenantId, recipeUserId, userContext?) => Promise<{
  status: "OK";
  wasAssociated: boolean;
}> = Wrapper.disassociateUserFromTenant;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
recipeUserId RecipeUserId
userContext? Record<string, any>

Returns

Promise<{ status: "OK"; wasAssociated: boolean; }>


getTenant()

getTenant: (tenantId, userContext?) => Promise<object & TenantConfig> = Wrapper.getTenant;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
tenantId string
userContext? Record<string, any>

Returns

Promise<object & TenantConfig>


init()

init: (config?) => RecipeListFunction = Wrapper.init;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
config? TypeInput

Returns

RecipeListFunction


listAllTenants()

listAllTenants: (userContext?) => Promise<{
  status: "OK";
  tenants: object & TenantConfig[];
}> = Wrapper.listAllTenants;

Defined in: recipe/multitenancy/index.ts

Parameters

Parameter Type
userContext? Record<string, any>

Returns

Promise<{ status: "OK"; tenants: object & TenantConfig[]; }>

References

APIInterface

Re-exports APIInterface


APIOptions

Re-exports APIOptions


RecipeInterface

Re-exports RecipeInterface

API reference

API schema and response details