-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Logout of Twitter #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logout of Twitter #645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import android.support.v4.app.FragmentActivity; | ||
|
||
import com.facebook.login.LoginManager; | ||
import com.firebase.ui.auth.provider.TwitterProvider; | ||
import com.firebase.ui.auth.ui.FlowParameters; | ||
import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity; | ||
import com.firebase.ui.auth.util.CredentialTaskApi; | ||
|
@@ -49,6 +50,7 @@ | |
import com.google.firebase.auth.FirebaseUser; | ||
import com.google.firebase.auth.GoogleAuthProvider; | ||
import com.google.firebase.auth.TwitterAuthProvider; | ||
import com.twitter.sdk.android.Twitter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
@@ -58,6 +60,8 @@ | |
import java.util.List; | ||
import java.util.Set; | ||
|
||
import io.fabric.sdk.android.Fabric; | ||
|
||
/** | ||
* The entry point to the AuthUI authentication flow, and related utility methods. If your | ||
* application uses the default {@link FirebaseApp} instance, an AuthUI instance can be retrieved | ||
|
@@ -192,6 +196,10 @@ public Void then(@NonNull Task<GoogleApiClient> task) throws Exception { | |
// Facebook sign out | ||
LoginManager.getInstance().logOut(); | ||
|
||
// Twitter sign out | ||
if (!Fabric.isInitialized()) TwitterProvider.initialize(activity); | ||
Twitter.logOut(); | ||
|
||
// Wait for all tasks to complete | ||
return Tasks.whenAll(disableCredentialsTask, googleSignOutTask); | ||
} | ||
|
@@ -239,6 +247,10 @@ public Task<Void> signOut(@NonNull FragmentActivity activity) { | |
// Facebook sign out | ||
LoginManager.getInstance().logOut(); | ||
|
||
// Twitter sign out | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samtstern Signing out of Twitter and Facebook should probably a method (something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep sign out all as one method for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM! |
||
if (!Fabric.isInitialized()) TwitterProvider.initialize(activity); | ||
Twitter.logOut(); | ||
|
||
// Wait for all tasks to complete | ||
return Tasks.whenAll(disableCredentialsTask, signOutTask); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also want to call:
Twitter.getSessionManager().clearActiveSession();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samtstern I thought so too, but
Twitter.logOut()
already does that for us:Actually, now that I'm paying more attention, it looks like that's all
Twitter#logOut()
does.The docs for
TwitterCore#logOut()
say it logs the user out, so I think that's all we have to do:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for digging, works for me!
The Twitter docs don't have anything at all on signOut ... oversight I guess.