الانتقال إلى وحدة التحكم

Firebase.Auth.FirebaseAuth

Firebase authentication object.

Summary

Firebase.Auth.FirebaseAuth is the gateway to the Firebase authentication API. With it, you can reference Firebase.Auth.FirebaseAuth objects to manage user accounts and credentials.

Each Firebase.FirebaseApp has up to one Firebase.Auth.FirebaseAuth class. You acquire the Firebase.Auth.FirebaseAuth class through the static function Firebase.Auth.FirebaseAuth.GetAuth.

For example:

// Get the Auth class for your App.
Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.GetAuth(app);

// Request anonymous sign-in and wait until asynchronous call completes.
auth.SignInAnonymouslyAsync().ContinueWith((authTask) => {
// Print sign in results.
  if (authTask.IsCanceled) {
    DebugLog("Sign-in canceled.");
  } else if (authTask.IsFaulted) {
    DebugLog("Sign-in encountered an error.");
    DebugLog(authTask.Exception.ToString());
  } else if (authTask.IsCompleted) {
    Firebase.Auth.User user = authTask.Result;
    DebugLog(String.Format("Signed in as {0} user.",
        user.Anonymous ? "an anonymous" : "a non-anonymous"));
    DebugLog("Signing out.");
    auth.SignOut();
});

Inheritance

Inherits from: SystemIDisposable

Properties

App
Get the FirebaseApp associated with this object.
CurrentUser
Synchronously gets the cached current user, or null if there is none.
DefaultInstance
static FirebaseAuth
Returns the FirebaseAuth associated with FirebaseApp.DefaultApp.
IdTokenChanged
System.EventHandler
Event raised on ID token changes.
StateChanged
System.EventHandler
Event raised on changes in the authentication state.

Public functions

CreateUserWithEmailAndPasswordAsync(string email, string password)
Creates, and on success, logs in a user with the given email address and 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)
Initiates a password reset for the given email address.
SignInAndRetrieveDataWithCredentialAsync(Credential credential)
Asynchronously logs into Firebase with the given credentials.
SignInAnonymouslyAsync()
Asynchronously creates and becomes an anonymous user.
SignInWithCredentialAsync(Credential credential)
Asynchronously logs into Firebase with the given Auth token.
SignInWithCustomTokenAsync(string token)
Asynchronously logs into Firebase with the given Auth token.
SignInWithEmailAndPasswordAsync(string email, string password)
Signs in using provided email address and password.
SignOut()
void
Removes any existing authentication credentials from this client.

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

Synchronously gets the cached current user, or null if there is none.

Note:Accessing this property may block and wait until the FirebaseAuth instance finishes loading the saved user's state. This should only happen for a short period of time after the FirebaseAuth instance is created.

DefaultInstance

static FirebaseAuth DefaultInstance

Returns the FirebaseAuth associated with FirebaseApp.DefaultApp.