firebase_admin.auth module

Firebase Authentication module.

This module contains helper methods and utilities for minting and verifying JWTs used for authenticating against Firebase services.

Functions

create_custom_token

firebase_admin.auth.create_custom_token(uid, developer_claims=None, app=None)

Builds and signs a Firebase custom auth token.

Parameters:
  • uid -- ID of the user for whom the token is created.
  • developer_claims -- A dictionary of claims to be included in the token (optional).
  • app -- An App instance (optional).
Returns:

A token minted from the input parameters.

Return type:

string

Raises:

ValueError -- If input parameters are invalid.

verify_id_token

firebase_admin.auth.verify_id_token(id_token, app=None)

Verifies the signature and data for the provided JWT.

Accepts a signed token string, verifies that it is current, and issued to this project, and that it was correctly signed by Google.

Parameters:
  • id_token -- A string of the encoded JWT.
  • app -- An App instance (optional).
Returns:

A dictionary of key-value pairs parsed from the decoded JWT.

Return type:

dict

Raises:
  • ValueError -- If the input parameters are invalid, or if the App was not initialized with a credentials.Certificate.
  • AppIdenityError -- The JWT was found to be invalid, the message will contain details.

Send feedback about...

Need help? Visit our support page.