Skip to content

Commit c49486e

Browse files
authored
Fix issue 1278 (#1279)
2 parents 4e51a45 + 47e9da7 commit c49486e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import com.facebook.login.LoginManager;
3333
import com.firebase.ui.auth.data.model.FlowParameters;
34+
import com.firebase.ui.auth.data.remote.TwitterSignInHandler;
3435
import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity;
3536
import com.firebase.ui.auth.util.CredentialUtils;
3637
import com.firebase.ui.auth.util.ExtraConstants;
@@ -276,7 +277,7 @@ public static int getDefaultTheme() {
276277
* UI-based sign-in flow knowing it is required.
277278
*
278279
* @param context requesting the user be signed in
279-
* @param desiredConfigs to use for silent sign in. Only Google and email are currently
280+
* @param configs to use for silent sign in. Only Google and email are currently
280281
* supported, the rest will be ignored.
281282
* @return a task which indicates whether or not the user was successfully signed in.
282283
*/
@@ -455,6 +456,7 @@ private Task<Void> signOutIdps(@NonNull Context context) {
455456
LoginManager.getInstance().logOut();
456457
}
457458
if (ProviderAvailability.IS_TWITTER_AVAILABLE) {
459+
TwitterSignInHandler.initializeTwitter();
458460
TwitterCore.getInstance().getSessionManager().clearActiveSession();
459461
}
460462
return GoogleSignIn.getClient(context, GoogleSignInOptions.DEFAULT_SIGN_IN).signOut();

auth/src/main/java/com/firebase/ui/auth/data/remote/TwitterSignInHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public TwitterSignInHandler(Application application) {
5050
mClient = new TwitterAuthClient();
5151
}
5252

53+
public static void initializeTwitter() {
54+
// This method is intentionally empty, but calling it forces the static {} block of this
55+
// class to be executed (if it wasn't already).
56+
//
57+
// Even though it's currently safe to initialize Twitter more than once, this protects
58+
// against a future behavior change and gives a small efficiency gain.
59+
}
60+
5361
private static IdpResponse createIdpResponse(
5462
TwitterSession session, String email, String name, Uri photoUri) {
5563
return new IdpResponse.Builder(

0 commit comments

Comments
 (0)