FirebaseAdmin.Auth.FirebaseAuth

This is the entry point to all server-side Firebase Authentication operations.

Summary

You can get an instance of this class viaFirebaseAuth.DefaultInstance.

Inheritance

Inherits from:FirebaseAdmin.Auth.AbstractFirebaseAuth

Properties

DefaultInstance
Gets the auth instance associated with the default Firebase app.

Public attributes

TenantManager => this.IfNotDeleted(() => this.tenantManager.Value)
Gets theTenantManager instance associated with the current project.

Public static functions

GetAuth(FirebaseApp app)
Returns the auth instance for the specified app.

Public functions

CreateSessionCookieAsync(string idToken,SessionCookieOptions options)
async Task< string >
Creates a new Firebase session cookie from the given ID token and options.
CreateSessionCookieAsync(string idToken,SessionCookieOptions options, CancellationToken cancellationToken)
async Task< string >
Creates a new Firebase session cookie from the given ID token and options.
VerifySessionCookieAsync(string sessionCookie)
async Task<FirebaseToken >
Parses and verifies a Firebase session cookie.
VerifySessionCookieAsync(string sessionCookie, CancellationToken cancellationToken)
async Task<FirebaseToken >
Parses and verifies a Firebase session cookie.
VerifySessionCookieAsync(string sessionCookie, bool checkRevoked)
async Task<FirebaseToken >
Parses and verifies a Firebase session cookie.
VerifySessionCookieAsync(string sessionCookie, bool checkRevoked, CancellationToken cancellationToken)
async Task<FirebaseToken >
Parses and verifies a Firebase session cookie.

Properties

DefaultInstance

staticFirebaseAuth DefaultInstance

Gets the auth instance associated with the default Firebase app.

This property isnull if the default app doesn't yet exist.

Public attributes

TenantManager

TenantManager TenantManager => this.IfNotDeleted(() => this.tenantManager.Value)

Gets theTenantManager instance associated with the current project.

Public static functions

GetAuth

FirebaseAuth GetAuth(FirebaseApp app)

Returns the auth instance for the specified app.

Details
Exceptions
System.ArgumentNullException
If the app argument is null.
Parameters
app
An app instance.
Returns
TheFirebaseAuth instance associated with the specified app.

Public functions

CreateSessionCookieAsync

async Task< string > CreateSessionCookieAsync(  string idToken,SessionCookieOptions options)

Creates a new Firebase session cookie from the given ID token and options.

The returned JWT can be set as a server-side session cookie with a custom cookie policy.

Details
Exceptions
FirebaseAuthException
If an error occurs while creating the cookie.
Parameters
idToken
The Firebase ID token to exchange for a session cookie.
options
Additional options required to create the cookie.
Returns
A task that completes with the Firebase session cookie.

CreateSessionCookieAsync

async Task< string > CreateSessionCookieAsync(  string idToken,SessionCookieOptions options,  CancellationToken cancellationToken)

Creates a new Firebase session cookie from the given ID token and options.

The returned JWT can be set as a server-side session cookie with a custom cookie policy.

Details
Exceptions
FirebaseAuthException
If an error occurs while creating the cookie.
Parameters
idToken
The Firebase ID token to exchange for a session cookie.
options
Additional options required to create the cookie.
cancellationToken
A cancellation token to monitor the asynchronous operation.
Returns
A task that completes with the Firebase session cookie.

VerifySessionCookieAsync

async Task<FirebaseToken > VerifySessionCookieAsync(  string sessionCookie)

Parses and verifies a Firebase session cookie.

SeeManage Session Cookies for code samples and detailed documentation.

Details
Exceptions
ArgumentException
If the session cookie is null or empty.
FirebaseAuthException
If the session cookie is invalid.
Parameters
sessionCookie
A Firebase session cookie string to verify and parse.
Returns
A task that completes with aFirebaseToken representing the verified and decoded session cookie.

VerifySessionCookieAsync

async Task<FirebaseToken > VerifySessionCookieAsync(  string sessionCookie,  CancellationToken cancellationToken)

Parses and verifies a Firebase session cookie.

SeeManage Session Cookies for code samples and detailed documentation.

Details
Exceptions
ArgumentException
If the session cookie is null or empty.
FirebaseAuthException
If the session cookie is invalid.
Parameters
sessionCookie
A Firebase session cookie string to verify and parse.
cancellationToken
A cancellation token to monitor the asynchronous operation.
Returns
A task that completes with aFirebaseToken representing the verified and decoded session cookie.

VerifySessionCookieAsync

async Task<FirebaseToken > VerifySessionCookieAsync(  string sessionCookie,  bool checkRevoked)

Parses and verifies a Firebase session cookie.

SeeManage Session Cookies for code samples and detailed documentation.

Details
Exceptions
ArgumentException
If the session cookie is null or empty.
FirebaseAuthException
If the session cookie is invalid.
Parameters
sessionCookie
A Firebase session cookie string to verify and parse.
checkRevoked
A boolean indicating whether to check if the tokens were revoked.
Returns
A task that completes with aFirebaseToken representing the verified and decoded session cookie.

VerifySessionCookieAsync

async Task<FirebaseToken > VerifySessionCookieAsync(  string sessionCookie,  bool checkRevoked,  CancellationToken cancellationToken)

Parses and verifies a Firebase session cookie.

SeeManage Session Cookies for code samples and detailed documentation.

Details
Exceptions
ArgumentException
If the session cookie is null or empty.
FirebaseAuthException
If the session cookie is invalid.
Parameters
sessionCookie
A Firebase session cookie string to verify and parse.
checkRevoked
A boolean indicating whether to check if the tokens were revoked.
cancellationToken
A cancellation token to monitor the asynchronous operation.
Returns
A task that completes with aFirebaseToken representing the verified and decoded session cookie.

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 2022-03-24 UTC.