## Functions

| Function | Description |
|---|---|
| [beforeEmailSent(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeemailsent) | Handles an event that is triggered before an email is sent to a user. |
| [beforeEmailSent(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeemailsent) | Handles an event that is triggered before an email is sent to a user. |
| [beforeOperation(eventType, optsOrHandler, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeoperation) |   |
| [beforeSmsSent(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforesmssent) | Handles an event that is triggered before an SMS is sent to a user. |
| [beforeSmsSent(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforesmssent) | Handles an event that is triggered before an SMS is sent to a user. |
| [beforeUserCreated(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeusercreated) | Handles an event that is triggered before a user is created. |
| [beforeUserCreated(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeusercreated) | Handles an event that is triggered before a user is created. |
| [beforeUserSignedIn(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeusersignedin) | Handles an event that is triggered before a user is signed in. |
| [beforeUserSignedIn(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitybeforeusersignedin) | Handles an event that is triggered before a user is signed in. |
| [getOpts(blockingOptions)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identitygetopts) |   |
| [onUserCreated(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonusercreated) | ***(BETA)*** Handles user creation events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserCreated(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonusercreated) | ***(BETA)*** Handles user creation events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserCreated(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonusercreated) | ***(BETA)*** Handles user creation events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserCreated(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonusercreated) | ***(BETA)*** Handles user creation events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserDeleted(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonuserdeleted) | ***(BETA)*** Handles user deletion events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserDeleted(handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonuserdeleted) | ***(BETA)*** Handles user deletion events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserDeleted(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonuserdeleted) | ***(BETA)*** Handles user deletion events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |
| [onUserDeleted(opts, handler)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityonuserdeleted) | ***(BETA)*** Handles user deletion events in Firebase Authentication.To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`. |

## Classes

| Class | Description |
|---|---|
| [HttpsError](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.httpserror#identityhttpserror_class) | 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface) | Defines the auth event for 2nd gen blocking events |
| [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface) | ***(BETA)*** The event object passed to the handler function for Firebase Authentication events. |
| [AuthOptions](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authoptions#identityauthoptions_interface) | ***(BETA)*** Options for configuring a Firebase Authentication trigger. |
| [AuthUserRecord](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authuserrecord#identityauthuserrecord_interface) | The `UserRecord` passed to auth blocking functions from the identity platform. |
| [BlockingOptions](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface) | All function options plus `idToken`, `accessToken`, and `refreshToken`. |

## Variables

| Variable | Description |
|---|---|
| [IS_NOT_TENANT](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityis_not_tenant) | ***(BETA)*** Constant to represent the absence of a tenant ID. |

## Type Aliases

| Type Alias | Description |
|---|---|
| [AuthEventHandler](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityautheventhandler) | ***(BETA)*** Event handler type for Firebase Authentication triggers that supports both standard `AuthEvent` and 1st gen compatibility destructuring (`{ user, context }`). |
| [User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser) | ***(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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface), "idToken" \| "accessToken" \| "refreshToken"\> | Object containing function options. |
| handler | (event: [AuthBlockingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface) \| ((event: [AuthBlockingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface), "idToken" \| "accessToken" \| "refreshToken"\> | Object containing function options. |
| handler | (event: [AuthBlockingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface) | Object containing function options. |
| handler | (event: [AuthBlockingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface) | Object containing function options. |
| handler | (event: [AuthBlockingEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authblockingevent#identityauthblockingevent_interface)) =\> 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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.blockingoptions#identityblockingoptions_interface) |   |

**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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\> \& V1Compat\<"user", [User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler which is run every time a new user is created. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**Signature:**

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

### Parameters

| Parameter | Type | Description |
|---|---|---|
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler which is run every time a new user is created. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authoptions#identityauthoptions_interface) | Object containing function options. |
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\> \& V1Compat\<"user", [User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler which is run every time a new user is created. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**Signature:**

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

### Parameters

| Parameter | Type | Description |
|---|---|---|
| opts | [AuthOptions](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authoptions#identityauthoptions_interface) | Object containing function options. |
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler which is run every time a new user is created. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\> \& V1Compat\<"user", [User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler that is run every time a user is deleted. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**Signature:**

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

### Parameters

| Parameter | Type | Description |
|---|---|---|
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler that is run every time a user is deleted. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**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](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authoptions#identityauthoptions_interface) | Object containing function options. |
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\> \& V1Compat\<"user", [User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler that is run every time a user is deleted. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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.

To filter for users not associated with a tenant, use the `IS_NOT_TENANT` constant in `opts`.

**Signature:**

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

### Parameters

| Parameter | Type | Description |
|---|---|---|
| opts | [AuthOptions](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authoptions#identityauthoptions_interface) | Object containing function options. |
| handler | (event: [AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>) =\> any \| Promise\<any\> | Event handler that is run every time a user is deleted. |

**Returns:**

[CloudFunction](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.cloudfunction#cloudfunction_interface)\<[AuthEvent](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity.authevent#identityauthevent_interface)\<[User](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.identity#identityuser)\>\>

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;