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)
onUserCreated(handler) (BETA) Handles user creation events in Firebase Authentication.
onUserCreated(handler) (BETA) Handles user creation events in Firebase Authentication.
onUserCreated(opts, handler) (BETA) Handles user creation events in Firebase Authentication.
onUserCreated(opts, handler) (BETA) Handles user creation events in Firebase Authentication.
onUserDeleted(handler) (BETA) Handles user deletion events in Firebase Authentication.
onUserDeleted(handler) (BETA) Handles user deletion events in Firebase Authentication.
onUserDeleted(opts, handler) (BETA) Handles user deletion events in Firebase Authentication.
onUserDeleted(opts, handler) (BETA) Handles user deletion events in Firebase Authentication.

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
AuthEvent (BETA) The event object passed to the handler function for Firebase Authentication events.
AuthOptions (BETA) Options for configuring a Firebase Authentication trigger.
AuthUserRecord The UserRecord passed to auth blocking functions from the identity platform.
BlockingOptions All function options plus idToken, accessToken, and refreshToken.

Variables

Variable Description
IS_NOT_TENANT (BETA) Constant to represent the absence of a tenant ID.

Type Aliases

Type Alias Description
AuthEventHandler (BETA) Event handler type for Firebase Authentication triggers that supports both standard AuthEvent and 1st gen compatibility destructuring ({ user, context }).
User (BETA) The user data payload for a Firebase Authentication event. This is the standard UserRecord from the Firebase Admin SDK.

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

identity.onUserCreated()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user creation events in Firebase Authentication.

Signature:

export declare function onUserCreated(handler: (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
handler (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any> Event handler which is run every time a new user is created.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserCreated()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user creation events in Firebase Authentication.

Signature:

export declare function onUserCreated(handler: (event: AuthEvent<User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
handler (event: AuthEvent<User>) => any | Promise<any> Event handler which is run every time a new user is created.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserCreated()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user creation events in Firebase Authentication.

Signature:

export declare function onUserCreated(opts: AuthOptions, handler: (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
opts AuthOptions Object containing function options.
handler (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any> Event handler which is run every time a new user is created.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserCreated()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user creation events in Firebase Authentication.

Signature:

export declare function onUserCreated(opts: AuthOptions, handler: (event: AuthEvent<User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
opts AuthOptions Object containing function options.
handler (event: AuthEvent<User>) => any | Promise<any> Event handler which is run every time a new user is created.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserDeleted()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user deletion events in Firebase Authentication.

Signature:

export declare function onUserDeleted(handler: (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
handler (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any> Event handler that is run every time a user is deleted.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserDeleted()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user deletion events in Firebase Authentication.

Signature:

export declare function onUserDeleted(handler: (event: AuthEvent<User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
handler (event: AuthEvent<User>) => any | Promise<any> Event handler that is run every time a user is deleted.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserDeleted()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user deletion events in Firebase Authentication.

Signature:

export declare function onUserDeleted(opts: AuthOptions, handler: (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
opts AuthOptions Object containing function options.
handler (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any> Event handler that is run every time a user is deleted.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.onUserDeleted()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Handles user deletion events in Firebase Authentication.

Signature:

export declare function onUserDeleted(opts: AuthOptions, handler: (event: AuthEvent<User>) => any | Promise<any>): CloudFunction<AuthEvent<User>>;

Parameters

Parameter Type Description
opts AuthOptions Object containing function options.
handler (event: AuthEvent<User>) => any | Promise<any> Event handler that is run every time a user is deleted.

Returns:

CloudFunction<AuthEvent<User>>

A Cloud Function that you can export.

identity.IS_NOT_TENANT

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Constant to represent the absence of a tenant ID.

Signature:

IS_NOT_TENANT: ResetValue

identity.AuthEventHandler

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Event handler type for Firebase Authentication triggers that supports both standard AuthEvent and 1st gen compatibility destructuring ({ user, context }).

Signature:

export type AuthEventHandler = (event: AuthEvent<User> & V1Compat<"user", User>) => any | Promise<any>;

identity.User

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

The user data payload for a Firebase Authentication event. This is the standard UserRecord from the Firebase Admin SDK.

Signature:

export type User = AdminUserRecord;