Package com.firebase.ui.auth
Class AuthUI
- java.lang.Object
-
- com.firebase.ui.auth.AuthUI
-
public final class AuthUI extends Object
The entry point to the AuthUI authentication flow, and related utility methods. If your application uses the defaultFirebaseApp
instance, an AuthUI instance can be retrieved simply by callinggetInstance()
. If an alternative app instance is in use, callgetInstance(FirebaseApp)
instead, passing the appropriate app instance.See the README for examples on how to get started with FirebaseUI Auth.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AuthUI.IdpConfig
Configuration for an identity provider.class
AuthUI.SignInIntentBuilder
Builder for the intent to start the user authentication flow.static interface
AuthUI.SupportedProvider
-
Field Summary
Fields Modifier and Type Field Description static String
ANONYMOUS_PROVIDER
Provider for anonymous users.static String
APPLE_PROVIDER
static String
EMAIL_LINK_PROVIDER
static String
MICROSOFT_PROVIDER
static int
NO_LOGO
Default value for logo resource, omits the logo from theAuthMethodPickerActivity
.static Set<String>
SOCIAL_PROVIDERS
The set of social authentication providers supported in Firebase Auth UI using their SDK.static Set<String>
SUPPORTED_OAUTH_PROVIDERS
The set of OAuth2.0 providers supported in Firebase Auth UI through Generic IDP (web flow).static Set<String>
SUPPORTED_PROVIDERS
The set of authentication providers supported in Firebase Auth UI.static String
TAG
static String
UNCONFIGURED_CONFIG_VALUE
static String
YAHOO_PROVIDER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canHandleIntent(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<Void>
delete(Context context)
Delete the use from FirebaseAuth and delete any associated credentials from the Credentials API.com.google.firebase.FirebaseApp
getApp()
static Context
getApplicationContext()
com.google.firebase.auth.FirebaseAuth
getAuth()
static int
getDefaultTheme()
Default theme used byAuthUI.AuthIntentBuilder.setTheme(int)
if no theme customization is required.String
getEmulatorHost()
int
getEmulatorPort()
static AuthUI
getInstance()
Retrieves theAuthUI
instance associated with the default app, as returned byFirebaseApp.getInstance()
.static AuthUI
getInstance(com.google.firebase.FirebaseApp app)
Retrieves theAuthUI
instance associated the the specified app.static AuthUI
getInstance(String appName)
Retrieves theAuthUI
instance associated the the specified app name.boolean
isUseEmulator()
static void
setApplicationContext(Context context)
com.google.android.gms.tasks.Task<Void>
signOut(Context context)
Signs the current user out, if one is signed in.com.google.android.gms.tasks.Task<com.google.firebase.auth.AuthResult>
silentSignIn(Context context, List<AuthUI.IdpConfig> configs)
Signs the user in without any UI if possible.void
useEmulator(String host, int port)
Connect to the Firebase Authentication emulator.
-
-
-
Field Detail
-
TAG
public static final String TAG
- See Also:
- Constant Field Values
-
ANONYMOUS_PROVIDER
public static final String ANONYMOUS_PROVIDER
Provider for anonymous users.- See Also:
- Constant Field Values
-
EMAIL_LINK_PROVIDER
public static final String EMAIL_LINK_PROVIDER
- See Also:
- Constant Field Values
-
MICROSOFT_PROVIDER
public static final String MICROSOFT_PROVIDER
- See Also:
- Constant Field Values
-
YAHOO_PROVIDER
public static final String YAHOO_PROVIDER
- See Also:
- Constant Field Values
-
APPLE_PROVIDER
public static final String APPLE_PROVIDER
- See Also:
- Constant Field Values
-
NO_LOGO
public static final int NO_LOGO
Default value for logo resource, omits the logo from theAuthMethodPickerActivity
.- See Also:
- Constant Field Values
-
SUPPORTED_PROVIDERS
public static final Set<String> SUPPORTED_PROVIDERS
The set of authentication providers supported in Firebase Auth UI.
-
SUPPORTED_OAUTH_PROVIDERS
public static final Set<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 Set<String> SOCIAL_PROVIDERS
The set of social authentication providers supported in Firebase Auth UI using their SDK.
-
UNCONFIGURED_CONFIG_VALUE
public static final String UNCONFIGURED_CONFIG_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getApplicationContext
@NonNull public static Context getApplicationContext()
-
setApplicationContext
public static void setApplicationContext(@NonNull Context context)
-
getInstance
@NonNull public static AuthUI getInstance()
Retrieves theAuthUI
instance associated with the default app, as returned byFirebaseApp.getInstance()
.- Throws:
IllegalStateException
- if the default app is not initialized.
-
getInstance
@NonNull public static AuthUI getInstance(@NonNull String appName)
Retrieves theAuthUI
instance associated the the specified app name.- Throws:
IllegalStateException
- if the app is not initialized.
-
getInstance
@NonNull public static AuthUI getInstance(@NonNull com.google.firebase.FirebaseApp app)
Retrieves theAuthUI
instance associated the the specified app.
-
getApp
@NonNull public com.google.firebase.FirebaseApp getApp()
-
getAuth
@NonNull public com.google.firebase.auth.FirebaseAuth getAuth()
-
canHandleIntent
public static boolean canHandleIntent(@NonNull 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 byAuthUI.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 Context context, @NonNull 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 inconfigs
- 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<Void> signOut(@NonNull 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<Void> delete(@NonNull Context context)
Delete the use from FirebaseAuth and delete any associated credentials from the Credentials API. Returns aTask
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 callingContext
.
-
useEmulator
public void useEmulator(@NonNull String host, int port)
Connect to the Firebase Authentication emulator.- See Also:
FirebaseAuth.useEmulator(String, int)
-
isUseEmulator
public boolean isUseEmulator()
-
getEmulatorHost
public String getEmulatorHost()
-
getEmulatorPort
public int getEmulatorPort()
-
createSignInIntentBuilder
@NonNull public AuthUI.SignInIntentBuilder createSignInIntentBuilder()
Starts the process of creating a sign in intent, with the mandatory application context parameter.
-
-