firebase_admin.credentials module

Firebase credentials module.

Classes

AccessTokenInfo

classfirebase_admin.credentials.AccessTokenInfo(access_token,expiry)

Bases:tuple

Data included in an OAuth2 access token.

Contains the access token string and the expiry time. The expiry time is exposed as adatetime value.

access_token

Alias for field number 0

expiry

Alias for field number 1

ApplicationDefault

classfirebase_admin.credentials.ApplicationDefault

Bases:Base

A Google Application Default credential.

get_credential()

Returns the underlying Google credential.

Raises:

google.auth.exceptions.DefaultCredentialsError – If Application Default credentials cannot be initialized in the current environment.

Returns:

A Google Auth credential instance.

Return type:

google.auth.credentials.Credentials

propertyproject_id

Returns the project_id from the underlying Google credential.

Raises:

google.auth.exceptions.DefaultCredentialsError – If Application Default credentials cannot be initialized in the current environment.

Returns:

The project id.

Return type:

str

Base

classfirebase_admin.credentials.Base

Bases:object

Provides OAuth2 access tokens for accessing Firebase services.

get_access_token()

Fetches a Google OAuth2 access token using this credential instance.

Returns:

An access token obtained using the credential.

Return type:

AccessTokenInfo

get_credential()

Returns the Google credential instance used for authentication.

Certificate

classfirebase_admin.credentials.Certificate(cert)

Bases:Base

A credential initialized from a JSON certificate keyfile.

get_credential()

Returns the underlying Google credential.

Returns:

A Google Auth credential instance.

Return type:

google.auth.credentials.Credentials

propertyproject_id
propertyservice_account_email
propertysigner

RefreshToken

classfirebase_admin.credentials.RefreshToken(refresh_token)

Bases:Base

A credential initialized from an existing refresh token.

get_credential()

Returns the underlying Google credential.

Returns:

A Google Auth credential instance.

Return type:

google.auth.credentials.Credentials

propertyclient_id
propertyclient_secret
propertyrefresh_token

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-23 UTC.