Class AuthUI


  • public final class AuthUI
    extends java.lang.Object
    The entry point to the AuthUI authentication flow, and related utility methods. If your application uses the default FirebaseApp instance, an AuthUI instance can be retrieved simply by calling getInstance(). If an alternative app instance is in use, call getInstance(FirebaseApp) instead, passing the appropriate app instance.

    See the README for examples on how to get started with FirebaseUI Auth.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean canHandleIntent​(android.content.Intent intent)
      Returns true if AuthUI can handle the intent.
      AuthUI.SignInIntentBuilder createSignInIntentBuilder()
      Starts the process of creating a sign in intent, with the mandatory application context parameter.
      com.google.android.gms.tasks.Task<java.lang.Void> delete​(android.content.Context context)
      Delete the use from FirebaseAuth and delete any associated credentials from the Credentials API.
      static android.content.Context getApplicationContext()  
      static int getDefaultTheme()
      Default theme used by AuthUI.AuthIntentBuilder.setTheme(int) if no theme customization is required.
      static AuthUI getInstance()
      Retrieves the AuthUI instance associated with the default app, as returned by FirebaseApp.getInstance().
      static AuthUI getInstance​(com.google.firebase.FirebaseApp app)
      Retrieves the AuthUI instance associated the the specified app.
      static void setApplicationContext​(android.content.Context context)  
      com.google.android.gms.tasks.Task<java.lang.Void> signOut​(android.content.Context context)
      Signs the current user out, if one is signed in.
      com.google.android.gms.tasks.Task<com.google.firebase.auth.AuthResult> silentSignIn​(android.content.Context context, java.util.List<AuthUI.IdpConfig> configs)
      Signs the user in without any UI if possible.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ANONYMOUS_PROVIDER

        public static final java.lang.String ANONYMOUS_PROVIDER
        Provider for anonymous users.
        See Also:
        Constant Field Values
      • EMAIL_LINK_PROVIDER

        public static final java.lang.String EMAIL_LINK_PROVIDER
        See Also:
        Constant Field Values
      • MICROSOFT_PROVIDER

        public static final java.lang.String MICROSOFT_PROVIDER
        See Also:
        Constant Field Values
      • SUPPORTED_PROVIDERS

        public static final java.util.Set<java.lang.String> SUPPORTED_PROVIDERS
        The set of authentication providers supported in Firebase Auth UI.
      • SUPPORTED_OAUTH_PROVIDERS

        public static final java.util.Set<java.lang.String> SUPPORTED_OAUTH_PROVIDERS
        The set of OAuth2.0 providers supported in Firebase Auth UI through Generic IDP (web flow).
      • SOCIAL_PROVIDERS

        public static final java.util.Set<java.lang.String> SOCIAL_PROVIDERS
        The set of social authentication providers supported in Firebase Auth UI using their SDK.
      • UNCONFIGURED_CONFIG_VALUE

        public static final java.lang.String UNCONFIGURED_CONFIG_VALUE
        See Also:
        Constant Field Values
    • Method Detail

      • getApplicationContext

        @NonNull
        public static android.content.Context getApplicationContext()
      • setApplicationContext

        public static void setApplicationContext​(@NonNull
                                                 android.content.Context context)
      • getInstance

        @NonNull
        public static AuthUI getInstance()
        Retrieves the AuthUI instance associated with the default app, as returned by FirebaseApp.getInstance().
        Throws:
        java.lang.IllegalStateException - if the default app is not initialized.
      • getInstance

        @NonNull
        public static AuthUI getInstance​(@NonNull
                                         com.google.firebase.FirebaseApp app)
        Retrieves the AuthUI instance associated the the specified app.
      • canHandleIntent

        public static boolean canHandleIntent​(@NonNull
                                              android.content.Intent intent)
        Returns true if AuthUI can handle the intent.

        AuthUI handle the intent when the embedded data is an email link. If it is, you can then specify the link in AuthUI.SignInIntentBuilder.setEmailLink(String) before starting AuthUI and it will be handled immediately.

      • getDefaultTheme

        @StyleRes
        public static int getDefaultTheme()
        Default theme used by AuthUI.AuthIntentBuilder.setTheme(int) if no theme customization is required.
      • silentSignIn

        @NonNull
        public com.google.android.gms.tasks.Task<com.google.firebase.auth.AuthResult> silentSignIn​(@NonNull
                                                                                                   android.content.Context context,
                                                                                                   @NonNull
                                                                                                   java.util.List<AuthUI.IdpConfig> configs)
        Signs the user in without any UI if possible. If this operation fails, you can safely start a UI-based sign-in flow knowing it is required.
        Parameters:
        context - requesting the user be signed in
        configs - to use for silent sign in. Only Google and email are currently supported, the rest will be ignored.
        Returns:
        a task which indicates whether or not the user was successfully signed in.
      • signOut

        @NonNull
        public com.google.android.gms.tasks.Task<java.lang.Void> signOut​(@NonNull
                                                                         android.content.Context context)
        Signs the current user out, if one is signed in.
        Parameters:
        context - the context requesting the user be signed out
        Returns:
        A task which, upon completion, signals that the user has been signed out (Task.isSuccessful(), or that the sign-out attempt failed unexpectedly !Task.isSuccessful()).
      • delete

        @NonNull
        public com.google.android.gms.tasks.Task<java.lang.Void> delete​(@NonNull
                                                                        android.content.Context context)
        Delete the use from FirebaseAuth and delete any associated credentials from the Credentials API. Returns a Task that succeeds if the Firebase Auth user deletion succeeds and fails if the Firebase Auth deletion fails. Credentials deletion failures are handled silently.
        Parameters:
        context - the calling Context.
      • createSignInIntentBuilder

        @NonNull
        public AuthUI.SignInIntentBuilder createSignInIntentBuilder()
        Starts the process of creating a sign in intent, with the mandatory application context parameter.