identity namespace

Functions

Function Description
beforeEmailSent(handler) Handles an event that is triggered before an email is sent to a user.
beforeEmailSent(opts, handler) Handles an event that is triggered before an email is sent to a user.
beforeOperation(eventType, optsOrHandler, handler)
beforeSmsSent(handler) Handles an event that is triggered before an SMS is sent to a user.
beforeSmsSent(opts, handler) Handles an event that is triggered before an SMS is sent to a user.
beforeUserCreated(handler) Handles an event that is triggered before a user is created.
beforeUserCreated(opts, handler) Handles an event that is triggered before a user is created.
beforeUserSignedIn(handler) Handles an event that is triggered before a user is signed in.
beforeUserSignedIn(opts, handler) Handles an event that is triggered before a user is signed in.
getOpts(blockingOptions)

Classes

Class Description
HttpsError An explicit error that can be thrown from a handler to send an error to the client that called the function.

Interfaces

Interface Description
AuthBlockingEvent Defines the auth event for 2nd gen blocking events
AuthUserRecord The UserRecord passed to auth blocking functions from the identity platform.
BlockingOptions All function options plus idToken, accessToken, and refreshToken.

identity.beforeEmailSent()

Handles an event that is triggered before an email is sent to a user.

Signature:

export declare function beforeEmailSent(handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeEmailResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeEmailResponse | void> Event handler that is run before an email is sent to a user.

Returns:

BlockingFunction

identity.beforeEmailSent()

Handles an event that is triggered before an email is sent to a user.

Signature:

export declare function beforeEmailSent(opts: Omit<BlockingOptions, "idToken" | "accessToken" | "refreshToken">, handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeEmailResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
opts Omit<BlockingOptions, "idToken" | "accessToken" | "refreshToken"> Object containing function options.
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeEmailResponse | void> Event handler that is run before an email is sent to a user.

Returns:

BlockingFunction

identity.beforeOperation()

Signature:

export declare function beforeOperation(eventType: AuthBlockingEventType, optsOrHandler: BlockingOptions | ((event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | BeforeSignInResponse | BeforeEmailResponse | BeforeSmsResponse | void>), handler: HandlerV2): BlockingFunction;

Parameters

Parameter Type Description
eventType AuthBlockingEventType
optsOrHandler BlockingOptions | ((event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | BeforeSignInResponse | BeforeEmailResponse | BeforeSmsResponse | void>)
handler HandlerV2

Returns:

BlockingFunction

identity.beforeSmsSent()

Handles an event that is triggered before an SMS is sent to a user.

Signature:

export declare function beforeSmsSent(handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeSmsResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeSmsResponse | void> Event handler that is run before an SMS is sent to a user.

Returns:

BlockingFunction

identity.beforeSmsSent()

Handles an event that is triggered before an SMS is sent to a user.

Signature:

export declare function beforeSmsSent(opts: Omit<BlockingOptions, "idToken" | "accessToken" | "refreshToken">, handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeSmsResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
opts Omit<BlockingOptions, "idToken" | "accessToken" | "refreshToken"> Object containing function options.
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeSmsResponse | void> Event handler that is run before an SMS is sent to a user.

Returns:

BlockingFunction

identity.beforeUserCreated()

Handles an event that is triggered before a user is created.

Signature:

export declare function beforeUserCreated(handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | void> Event handler which is run every time before a user is created.

Returns:

BlockingFunction

identity.beforeUserCreated()

Handles an event that is triggered before a user is created.

Signature:

export declare function beforeUserCreated(opts: BlockingOptions, handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
opts BlockingOptions Object containing function options.
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeCreateResponse | void> Event handler which is run every time before a user is created.

Returns:

BlockingFunction

identity.beforeUserSignedIn()

Handles an event that is triggered before a user is signed in.

Signature:

export declare function beforeUserSignedIn(handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeSignInResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeSignInResponse | void> Event handler which is run every time before a user is signed in.

Returns:

BlockingFunction

identity.beforeUserSignedIn()

Handles an event that is triggered before a user is signed in.

Signature:

export declare function beforeUserSignedIn(opts: BlockingOptions, handler: (event: AuthBlockingEvent) => MaybeAsync<BeforeSignInResponse | void>): BlockingFunction;

Parameters

Parameter Type Description
opts BlockingOptions Object containing function options.
handler (event: AuthBlockingEvent) => MaybeAsync<BeforeSignInResponse | void> Event handler which is run every time before a user is signed in.

Returns:

BlockingFunction

identity.getOpts()

Signature:

export declare function getOpts(blockingOptions: BlockingOptions): InternalOptions;

Parameters

Parameter Type Description
blockingOptions BlockingOptions

Returns:

InternalOptions