Skip to content

Commit d517973

Browse files
SUPERCILEXsamtstern
authored andcommitted
Remove in-depth documentation for AuthUI.java and link to README instead (#569)
1 parent 85d7b70 commit d517973

File tree

2 files changed

+15
-174
lines changed

2 files changed

+15
-174
lines changed

auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ and [Web](https://github.com/firebase/firebaseui-web/).
2929

3030
![FirebaseUI authentication demo on Android](demo.gif)
3131

32-
## Table of Content
32+
## Table of Contents
3333

3434
1. [Configuration](#configuration)
3535
2. [Usage instructions](#using-firebaseui-for-authentication)

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 14 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -60,173 +60,14 @@
6060
import java.util.Set;
6161

6262
/**
63-
* The entry point to the AuthUI authentication flow, and related utility methods.
64-
* If your application uses the default {@link FirebaseApp} instance, an AuthUI instance can
65-
* be retrieved simply by calling {@link AuthUI#getInstance() AuthUI.getInstance()}.
66-
* If an alternative app instance is in use, call
67-
* {@link AuthUI#getInstance(FirebaseApp) AuthUI.getInstance(app} instead, passing the
68-
* appropriate app instance.
63+
* The entry point to the AuthUI authentication flow, and related utility methods. If your
64+
* application uses the default {@link FirebaseApp} instance, an AuthUI instance can be retrieved
65+
* simply by calling {@link AuthUI#getInstance()}. If an alternative app instance is in use, call
66+
* {@link AuthUI#getInstance(FirebaseApp)} instead, passing the appropriate app instance.
6967
* <p>
70-
* <h2>Sign-in</h2>
7168
* <p>
72-
* If a user is not currently signed in (as can be determined by checking
73-
* {@code auth.getCurrentUser() != null}, where {@code auth} is the {@link FirebaseAuth}
74-
* associated with your {@link FirebaseApp}) then the sign-in process can be started by creating
75-
* a sign-in intent using {@link SignInIntentBuilder}. A builder instance can be retrieved by
76-
* calling {@link AuthUI#createSignInIntentBuilder()}.
77-
* <p>
78-
* <p>The builder provides the following customization options for the authentication flow
79-
* implemented by this library:
80-
* <p>
81-
* <ul>
82-
* <li>The set of authentication methods desired can be specified.</li>
83-
* <li>The terms of service URL for your app can be specified, which is included as a link
84-
* in the small-print of the account creation step for new users. If no terms of service
85-
* URL is provided, the associated small-print is omitted.
86-
* </li>
87-
* <li>A custom theme can specified for the flow, which is applied to all the activities in
88-
* the flow for consistent customization of colors and typography.
89-
* </li>
90-
* </ul>
91-
* <p>
92-
* <p>
93-
* <h3>Sign-in examples</h3>
94-
* <p>
95-
* If no customization is required, and only email authentication is required, the sign-in flow
96-
* can be started as follows:
97-
* <p>
98-
* <pre>
99-
* {@code
100-
* startActivityForResult(
101-
* AuthUI.getInstance().createSignInIntentBuilder().build(),
102-
* RC_SIGN_IN);
103-
* }
104-
* </pre>
105-
* <p>
106-
* If Google Sign-in and Facebook Sign-in are also required, then this can be replaced with:
107-
* <p>
108-
* <pre>
109-
* {@code
110-
* startActivityForResult(
111-
* AuthUI.getInstance()
112-
* .createSignInIntentBuilder()
113-
* .setProviders(
114-
* Arrays.asList(
115-
* new IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
116-
* new IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
117-
* new IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build()
118-
* )
119-
* )
120-
* .build(),
121-
* RC_SIGN_IN);
122-
* }
123-
* </pre>
124-
* <p>
125-
* Finally, if a terms of service URL and a custom theme are required:
126-
* <p>
127-
* <pre>
128-
* {@code
129-
* startActivityForResult(
130-
* AuthUI.getInstance()
131-
* .createSignInIntentBuilder()
132-
* .setProviders(...)
133-
* .setTosUrl("https://superapp.example.com/terms-of-service.html")
134-
* .setTheme(R.style.SuperAppTheme)
135-
* .build(),
136-
* RC_SIGN_IN);
137-
* }
138-
* </pre>
139-
* <p>
140-
* <h3>Handling the Sign-in response</h3>
141-
* <p>
142-
* The authentication flow provides only two response codes:
143-
* {@link ResultCodes#OK RESULT_OK} if a user is signed in,
144-
* and {@link ResultCodes#CANCELED RESULT_CANCELLED} if sign in
145-
* failed. No further information on failure is provided as it is not typically useful; the only
146-
* recourse for most apps if sign in fails is to ask the user to sign in again later, or proceed
147-
* with an anonymous account if supported.
148-
* <p>
149-
* <pre>
150-
* {@code
151-
* @Override
152-
* protected void onActivityResult(int requestCode, int resultCode, Intent data) {
153-
* super.onActivityResult(requestCode, resultCode, data);
154-
* if (requestCode == RC_SIGN_IN) {
155-
* if (resultCode == ResultCodes.OK) {
156-
* // user is signed in!
157-
* startActivity(new Intent(this, WelcomeBackActivity.class));
158-
* finish();
159-
* } else {
160-
* // user is not signed in :(
161-
* // Maybe just wait for the user to press "sign in" again, or show a message
162-
* showSnackbar("Sign in is required to use this app.");
163-
* }
164-
* }
165-
* }
166-
* </pre>
167-
* <p>
168-
* <h2>Sign-out</h2>
169-
* <p>
170-
* With the integrations provided by AuthUI, signing out a user is a multi-stage process:
171-
* <p>
172-
* <ol>
173-
* <li>The user must be signed out of the {@link FirebaseAuth} instance.</li>
174-
* <li>Smart Lock for Passwords must be instructed to disable automatic sign-in, in
175-
* order to prevent an automatic sign-in loop that prevents the user from switching
176-
* accounts.
177-
* </li>
178-
* <li>If the current user signed in using either Google or Facebook, the user must also be
179-
* signed out using the associated API for that authentication method. This typically
180-
* ensures that the user will not be automatically signed-in using the current account
181-
* when using that authentication method again from the authentication method picker, which
182-
* would also prevent the user from switching between accounts on the same provider.
183-
* </li>
184-
* </ol>
185-
* <p>
186-
* In order to make this process easier, AuthUI provides a simple
187-
* {@link AuthUI#signOut(Activity) signOut} method to encapsulate this behavior. The method returns
188-
* a {@link Task} which is marked completed once all necessary sign-out operations are completed:
189-
* <p>
190-
* <pre>
191-
* {@code
192-
* public void onClick(View v) {
193-
* if (v.getId() == R.id.sign_out) {
194-
* AuthUI.getInstance()
195-
* .signOut(this)
196-
* .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
197-
* public void onComplete(@NonNull Task<AuthResult> task) {
198-
* // user is now signed out
199-
* startActivity(new Intent(MyActivity.this, SignInActivity.class));
200-
* finish();
201-
* });
202-
* }
203-
* }
204-
* </pre>
205-
* <p>
206-
* <h2>IDP Provider configuration</h2>
207-
* <p>
208-
* Interacting with identity providers typically requires some additional client configuration.
209-
* AuthUI currently supports Google Sign-in and Facebook Sign-in, and currently requires the
210-
* basic configuration for these providers to be specified via string properties:
211-
* <p>
212-
* <ul>
213-
* <p>
214-
* <li>Google Sign-in: If your app build uses the
215-
* <a href="https://developers.google.com/android/guides/google-services-plugin">Google
216-
* Services Gradle Plugin</a>, no additional configuration is required. If not, please override
217-
* {@code R.string.default_web_client_id} to provide your
218-
* <a href="https://developers.google.com/identity/sign-in/web/devconsole-project">Google OAuth
219-
* web client id.</a>
220-
* </li>
221-
* <p>
222-
* <li>Facebook Sign-in: Please override the string resource
223-
* {@code facebook_application_id} to provide the
224-
* <a href="https://developers.facebook.com/docs/apps/register">App ID</a> for your app as
225-
* registered on the
226-
* <a href="https://developers.facebook.com/apps">Facebook Developer Dashboard</a>.
227-
* </li>
228-
* <p>
229-
* </ul>
69+
* See the <a href="https://github.com/firebase/FirebaseUI-Android/blob/master/auth/README.md#table-of-contents">README</a>
70+
* for examples on how to get started with FirebaseUI Auth.
23071
*/
23172
public class AuthUI {
23273

@@ -252,8 +93,7 @@ public class AuthUI {
25293
public static final String TWITTER_PROVIDER = TwitterAuthProvider.PROVIDER_ID;
25394

25495
/**
255-
* Default value for logo resource, omits the logo from the
256-
* {@link AuthMethodPickerActivity}
96+
* Default value for logo resource, omits the logo from the {@link AuthMethodPickerActivity}.
25797
*/
25898
public static final int NO_LOGO = -1;
25999

@@ -304,8 +144,8 @@ public static AuthUI getInstance(FirebaseApp app) {
304144
}
305145

306146
/**
307-
* Default theme used by {@link SignInIntentBuilder#setTheme(int)} if no theme
308-
* customization is required.
147+
* Default theme used by {@link SignInIntentBuilder#setTheme(int)} if no theme customization is
148+
* required.
309149
*/
310150
@StyleRes
311151
public static int getDefaultTheme() {
@@ -524,9 +364,9 @@ public static class Builder {
524364
/**
525365
* Builds the configuration parameters for an identity provider.
526366
*
527-
* @param providerId An ID of one of the supported identity providers. e.g.
528-
* {@link AuthUI#GOOGLE_PROVIDER}. See {@link AuthUI#SUPPORTED_PROVIDERS} for the
529-
* complete list of supported Identity providers
367+
* @param providerId An ID of one of the supported identity providers. e.g. {@link
368+
* AuthUI#GOOGLE_PROVIDER}. See {@link AuthUI#SUPPORTED_PROVIDERS} for
369+
* the complete list of supported Identity providers
530370
*/
531371
public Builder(@NonNull String providerId) {
532372
if (!SUPPORTED_PROVIDERS.contains(providerId)) {
@@ -546,7 +386,8 @@ public Builder(@NonNull String providerId) {
546386
* For Google permissions see:
547387
* https://developers.google.com/identity/protocols/googlescopes
548388
* <p>
549-
* Twitter permissions are only configurable through the Twitter developer console.
389+
* Twitter permissions are only configurable through the
390+
* <a href="https://apps.twitter.com/">Twitter developer console</a>.
550391
*/
551392
public Builder setPermissions(List<String> permissions) {
552393
mScopes = permissions;

0 commit comments

Comments
 (0)