Firebase.Auth.FirebaseAuth

Summary

Inheritance

Inherits from: SystemIDisposable

Properties

App
Get the FirebaseApp associated with this object.
CurrentUser
DefaultInstance
static FirebaseAuth
Returns the FirebaseAuth associated with FirebaseApp.DefaultApp.

Events

StateChanged
System.EventHandler
Event raised on changes in the authentication state.

Public functions

CreateUserWithEmailAndPasswordAsync(string email, string password)
Dispose()
void
FetchProvidersForEmailAsync(string email)
System.Threading.Tasks.Task< System.Collections.Generic.IEnumerable< string > >
Asynchronously requests the IDPs (identity providers) that can be used for the given email address.
SendPasswordResetEmailAsync(string email)
SignInAnonymouslyAsync()
SignInWithCredentialAsync(Credential credential)
SignInWithCustomTokenAsync(string token)
SignInWithEmailAndPasswordAsync(string email, string password)
SignOut()
void

Public static functions

GetAuth(FirebaseApp app)
Returns the FirebaseAuth object for an App.

Properties

App

FirebaseApp App

Get the FirebaseApp associated with this object.

Details
Returns
FirebaseApp associated with this object.

CurrentUser

FirebaseUser CurrentUser

DefaultInstance

static FirebaseAuth DefaultInstance

Returns the FirebaseAuth associated with FirebaseApp.DefaultApp.

FirebaseAuth will be created if required.

Details
Exceptions
InitializationException
Thrown with the invalid InitResult if initialization failed.

Events

StateChanged

System.EventHandler StateChanged

Event raised on changes in the authentication state.

Authentication state changes are:

  • When a user signs in
  • When the current user signs out
  • When the current user changes
  • When there is a change in the current user's token

It is a recommended practice to always listen to sign-out events, as you may want to prompt the user to sign in again and maybe restrict the information or actions they have access to.

Public functions

CreateUserWithEmailAndPasswordAsync

System.Threading.Tasks.Task< FirebaseUser > CreateUserWithEmailAndPasswordAsync(
  string email,
  string password
)

Dispose

void Dispose()

FetchProvidersForEmailAsync

System.Threading.Tasks.Task< System.Collections.Generic.IEnumerable< string > > FetchProvidersForEmailAsync(
  string email
)

Asynchronously requests the IDPs (identity providers) that can be used for the given email address.

Useful for an "identifier-first" login flow.

// Print out all available providers for a given email.
void DisplayIdentityProviders(Firebase.Auth.FirebaseAuth auth,
                              String email) {
  auth.FetchProvidersForEmailAsync().ContinueWith((authTask) => {
    if (authTask.IsCanceled) {
      DebugLog("Provider fetch canceled.");
    } else if (authTask.IsFaulted) {
      DebugLog("Provider fetch encountered an error.");
      DebugLog(authTask.Exception.ToString());
    } else if (authTask.IsCompleted) {
      DebugLog("Email Providers:");
      foreach (string provider in authTask.result) {
        DebugLog(provider);
      }
    }
  });
}

SendPasswordResetEmailAsync

System.Threading.Tasks.Task SendPasswordResetEmailAsync(
  string email
)

SignInAnonymouslyAsync

System.Threading.Tasks.Task< FirebaseUser > SignInAnonymouslyAsync()

SignInWithCredentialAsync

System.Threading.Tasks.Task< FirebaseUser > SignInWithCredentialAsync(
  Credential credential
)

SignInWithCustomTokenAsync

System.Threading.Tasks.Task< FirebaseUser > SignInWithCustomTokenAsync(
  string token
)

SignInWithEmailAndPasswordAsync

System.Threading.Tasks.Task< FirebaseUser > SignInWithEmailAndPasswordAsync(
  string email,
  string password
)

SignOut

void SignOut()

Public static functions

GetAuth

FirebaseAuth GetAuth(
  FirebaseApp app
)

Returns the FirebaseAuth object for an App.

Creates the FirebaseAuth if required.

Details
Parameters
app
The FirebaseApp to use for the FirebaseAuth object.
Exceptions
InitializationException
Thrown with the invalid InitResult if initialization failed.

Send feedback about...

Need help? Visit our support page.