Skip to main content
References

Account Linking

Classes

default

Defined in: recipe/accountlinking/index.ts:23

Constructors

Constructor
new default(): default;
Returns

default

Properties

PropertyModifierTypeDefault valueDefined in
initstatic(config?) => RecipeListFunctionRecipe.initrecipe/accountlinking/index.ts:24

Methods

canCreatePrimaryUser()
static canCreatePrimaryUser(recipeUserId, userContext?): Promise<
| {
status: "OK";
wasAlreadyAPrimaryUser: boolean;
}
| {
description: string;
primaryUserId: string;
status: | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR";
}>;

Defined in: recipe/accountlinking/index.ts:84

Parameters
ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>
Returns

Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; } | { description: string; primaryUserId: string; status: | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR" | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; }>

canLinkAccounts()
static canLinkAccounts(
recipeUserId,
primaryUserId,
userContext?): Promise<
| {
accountsAlreadyLinked: boolean;
status: "OK";
}
| {
description: string;
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
status: "INPUT_USER_IS_NOT_A_PRIMARY_USER";
}>;

Defined in: recipe/accountlinking/index.ts:98

Parameters
ParameterType
recipeUserIdRecipeUserId
primaryUserIdstring
userContext?Record<string, any>
Returns

Promise< | { accountsAlreadyLinked: boolean; status: "OK"; } | { description: string; primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; }>

createPrimaryUser()
static createPrimaryUser(recipeUserId, userContext?): Promise<
| {
status: "OK";
user: User;
wasAlreadyAPrimaryUser: boolean;
}
| {
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR";
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}>;

Defined in: recipe/accountlinking/index.ts:91

Parameters
ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>
Returns

Promise< | { status: "OK"; user: User; wasAlreadyAPrimaryUser: boolean; } | { primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; }>

createPrimaryUserIdOrLinkAccounts()
static createPrimaryUserIdOrLinkAccounts(
tenantId,
recipeUserId,
session?,
userContext?): Promise<User>;

Defined in: recipe/accountlinking/index.ts:35

This is a function which is a combination of createPrimaryUser and linkAccounts where the input recipeUserId is either linked to a user that it can be linked to, or is made into a primary user.

The output will be the user ID of the user that it was linked to, or it will be the same as the input recipeUserId if it was made into a primary user, or if there was no linking that happened.

Parameters
ParameterType
tenantIdstring
recipeUserIdRecipeUserId
session?SessionContainerInterface
userContext?Record<string, any>
Returns

Promise<User>

getPrimaryUserThatCanBeLinkedToRecipeUserId()
static getPrimaryUserThatCanBeLinkedToRecipeUserId(
tenantId,
recipeUserId,
userContext?): Promise<User>;

Defined in: recipe/accountlinking/index.ts:67

This function returns the primary user that the input recipe ID can be linked to. It can be used to determine which primary account the linking will happen to if the input recipe user ID was to be linked.

If the function returns undefined, it means that there is no primary user that the input recipe ID can be linked to, and therefore it can be made into a primary user itself.

Parameters
ParameterType
tenantIdstring
recipeUserIdRecipeUserId
userContext?Record<string, any>
Returns

Promise<User>

isEmailChangeAllowed()
static isEmailChangeAllowed(
recipeUserId,
newEmail,
isVerified,
session?,
userContext?): Promise<boolean>;

Defined in: recipe/accountlinking/index.ts:159

Parameters
ParameterType
recipeUserIdRecipeUserId
newEmailstring
isVerifiedboolean
session?SessionContainerInterface
userContext?Record<string, any>
Returns

Promise<boolean>

isSignInAllowed()
static isSignInAllowed(
tenantId,
recipeUserId,
session?,
userContext?): Promise<boolean>;

Defined in: recipe/accountlinking/index.ts:137

Parameters
ParameterType
tenantIdstring
recipeUserIdRecipeUserId
session?SessionContainerInterface
userContext?Record<string, any>
Returns

Promise<boolean>

isSignUpAllowed()
static isSignUpAllowed(
tenantId,
newUser,
isVerified,
session?,
userContext?): Promise<boolean>;

Defined in: recipe/accountlinking/index.ts:121

Parameters
ParameterType
tenantIdstring
newUserAccountInfoWithRecipeId
isVerifiedboolean
session?SessionContainerInterface
userContext?Record<string, any>
Returns

Promise<boolean>

linkAccounts()
static linkAccounts(
recipeUserId,
primaryUserId,
userContext?): Promise<
| {
accountsAlreadyLinked: boolean;
status: "OK";
user: User;
}
| {
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
user: User;
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
status: "INPUT_USER_IS_NOT_A_PRIMARY_USER";
}>;

Defined in: recipe/accountlinking/index.ts:106

Parameters
ParameterType
recipeUserIdRecipeUserId
primaryUserIdstring
userContext?Record<string, any>
Returns

Promise< | { accountsAlreadyLinked: boolean; status: "OK"; user: User; } | { primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; user: User; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; }>

unlinkAccount()
static unlinkAccount(recipeUserId, userContext?): Promise<{
status: "OK";
wasLinked: boolean;
wasRecipeUserDeleted: boolean;
}>;

Defined in: recipe/accountlinking/index.ts:114

Parameters
ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>
Returns

Promise<{ status: "OK"; wasLinked: boolean; wasRecipeUserDeleted: boolean; }>

Variables

canCreatePrimaryUser()

const canCreatePrimaryUser: (recipeUserId, userContext?) => Promise<
| {
status: "OK";
wasAlreadyAPrimaryUser: boolean;
}
| {
description: string;
primaryUserId: string;
status: | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
| "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR";
}> = Wrapper.canCreatePrimaryUser;

Defined in: recipe/accountlinking/index.ts:184

Parameters

ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>

Returns

Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; } | { description: string; primaryUserId: string; status: | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR" | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; }>

canLinkAccounts()

const canLinkAccounts: (recipeUserId, primaryUserId, userContext?) => Promise<
| {
accountsAlreadyLinked: boolean;
status: "OK";
}
| {
description: string;
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
status: "INPUT_USER_IS_NOT_A_PRIMARY_USER";
}> = Wrapper.canLinkAccounts;

Defined in: recipe/accountlinking/index.ts:186

Parameters

ParameterType
recipeUserIdRecipeUserId
primaryUserIdstring
userContext?Record<string, any>

Returns

Promise< | { accountsAlreadyLinked: boolean; status: "OK"; } | { description: string; primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; }>

createPrimaryUser()

const createPrimaryUser: (recipeUserId, userContext?) => Promise<
| {
status: "OK";
user: User;
wasAlreadyAPrimaryUser: boolean;
}
| {
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR";
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}> = Wrapper.createPrimaryUser;

Defined in: recipe/accountlinking/index.ts:185

Parameters

ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>

Returns

Promise< | { status: "OK"; user: User; wasAlreadyAPrimaryUser: boolean; } | { primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; }>

createPrimaryUserIdOrLinkAccounts()

const createPrimaryUserIdOrLinkAccounts: (tenantId, recipeUserId, session?, userContext?) => Promise<User> = Wrapper.createPrimaryUserIdOrLinkAccounts;

Defined in: recipe/accountlinking/index.ts:189

This is a function which is a combination of createPrimaryUser and linkAccounts where the input recipeUserId is either linked to a user that it can be linked to, or is made into a primary user.

The output will be the user ID of the user that it was linked to, or it will be the same as the input recipeUserId if it was made into a primary user, or if there was no linking that happened.

Parameters

ParameterType
tenantIdstring
recipeUserIdRecipeUserId
session?SessionContainerInterface
userContext?Record<string, any>

Returns

Promise<User>

getPrimaryUserThatCanBeLinkedToRecipeUserId()

const getPrimaryUserThatCanBeLinkedToRecipeUserId: (tenantId, recipeUserId, userContext?) => Promise<User> = Wrapper.getPrimaryUserThatCanBeLinkedToRecipeUserId;

Defined in: recipe/accountlinking/index.ts:190

This function returns the primary user that the input recipe ID can be linked to. It can be used to determine which primary account the linking will happen to if the input recipe user ID was to be linked.

If the function returns undefined, it means that there is no primary user that the input recipe ID can be linked to, and therefore it can be made into a primary user itself.

Parameters

ParameterType
tenantIdstring
recipeUserIdRecipeUserId
userContext?Record<string, any>

Returns

Promise<User>

init()

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

Defined in: recipe/accountlinking/index.ts:183

Parameters

ParameterType
config?TypeInput

Returns

RecipeListFunction

isEmailChangeAllowed()

const isEmailChangeAllowed: (recipeUserId, newEmail, isVerified, session?, userContext?) => Promise<boolean> = Wrapper.isEmailChangeAllowed;

Defined in: recipe/accountlinking/index.ts:193

Parameters

ParameterType
recipeUserIdRecipeUserId
newEmailstring
isVerifiedboolean
session?SessionContainerInterface
userContext?Record<string, any>

Returns

Promise<boolean>

isSignInAllowed()

const isSignInAllowed: (tenantId, recipeUserId, session?, userContext?) => Promise<boolean> = Wrapper.isSignInAllowed;

Defined in: recipe/accountlinking/index.ts:192

Parameters

ParameterType
tenantIdstring
recipeUserIdRecipeUserId
session?SessionContainerInterface
userContext?Record<string, any>

Returns

Promise<boolean>

isSignUpAllowed()

const isSignUpAllowed: (tenantId, newUser, isVerified, session?, userContext?) => Promise<boolean> = Wrapper.isSignUpAllowed;

Defined in: recipe/accountlinking/index.ts:191

Parameters

ParameterType
tenantIdstring
newUserAccountInfoWithRecipeId
isVerifiedboolean
session?SessionContainerInterface
userContext?Record<string, any>

Returns

Promise<boolean>

linkAccounts()

const linkAccounts: (recipeUserId, primaryUserId, userContext?) => Promise<
| {
accountsAlreadyLinked: boolean;
status: "OK";
user: User;
}
| {
primaryUserId: string;
status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
user: User;
}
| {
description: string;
primaryUserId: string;
status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
}
| {
status: "INPUT_USER_IS_NOT_A_PRIMARY_USER";
}> = Wrapper.linkAccounts;

Defined in: recipe/accountlinking/index.ts:187

Parameters

ParameterType
recipeUserIdRecipeUserId
primaryUserIdstring
userContext?Record<string, any>

Returns

Promise< | { accountsAlreadyLinked: boolean; status: "OK"; user: User; } | { primaryUserId: string; status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; user: User; } | { description: string; primaryUserId: string; status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } | { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; }>

unlinkAccount()

const unlinkAccount: (recipeUserId, userContext?) => Promise<{
status: "OK";
wasLinked: boolean;
wasRecipeUserDeleted: boolean;
}> = Wrapper.unlinkAccount;

Defined in: recipe/accountlinking/index.ts:188

Parameters

ParameterType
recipeUserIdRecipeUserId
userContext?Record<string, any>

Returns

Promise<{ status: "OK"; wasLinked: boolean; wasRecipeUserDeleted: boolean; }>

References

RecipeInterface

Re-exports RecipeInterface