MongoServiceMagicLink

@accounts/mongo-magic-linkGlobalsMongoServiceMagicLink

Hierarchy

  • MongoServiceMagicLink

Implements

  • DatabaseInterfaceServiceMagicLink

Index

Constructors

Methods

Constructors

constructor

+ new MongoServiceMagicLink(options: MongoServiceMagicLinkOptions): MongoServiceMagicLink

Defined in mongo-magic-link.ts:39

Parameters:

NameType
optionsMongoServiceMagicLinkOptions

Returns: MongoServiceMagicLink

Methods

addLoginToken

addLoginToken(userId: string, email: string, token: string): Promise‹void›

Defined in mongo-magic-link.ts:83

Add a login token to a user.

Parameters:

NameTypeDescription
userIdstringId used to update the user.
emailstringWhich address of the user's to link the token to.
tokenstringRandom token used to allow user to login.

Returns: Promise‹void›


findUserByLoginToken

findUserByLoginToken(token: string): Promise‹User | null›

Defined in mongo-magic-link.ts:67

Find a user from a login token.

Parameters:

NameTypeDescription
tokenstringRandom token used to allow user to login.

Returns: Promise‹User | null›


removeAllLoginTokens

removeAllLoginTokens(userId: string): Promise‹void›

Defined in mongo-magic-link.ts:103

Remove all the login tokens for a user.

Parameters:

NameTypeDescription
userIdstringId used to update the user.

Returns: Promise‹void›


setupIndexes

setupIndexes(options: Omit‹IndexOptions, "unique" | "sparse"›): Promise‹void›

Defined in mongo-magic-link.ts:55

Setup the mongo indexes needed for the token service.

Parameters:

NameTypeDefaultDescription
optionsOmit‹IndexOptions, "unique" | "sparse"›{}Options passed to the mongo native createIndex method.

Returns: Promise‹void›