I am using TwitterKit to log in users to the app. I am using a custom button in a fragment and TwitterAuthClient to authorize users. The login happy flow is working as expected.
However, when I cancel the authorization and try to log in again by clicking on the login button, I get the following error:
com.twitter.sdk.android.core.TwitterAuthException: Authorize failed.
I have tried clearing the active session and logging out before trying to login for the second time after canceling, but it didn't solve the issue.
Twitter.getSessionManager().clearActiveSession();
Twitter.logOut();
Any help would be appreciated!
Maybe the problem is that you are using the Fragment, instead of Activity, and Login Button Logic cannot go through its lifecycle. You can try to "recreate" the fragment by replacing the existing one, using Fragments Transactions, when you cancel the authorization.
I can't give you more answer, because you haven't given your code snippet. Maybe you forgot to add onActivityResult method? Try also look at this and this answers. Also, you may ask questions on that "twittercommunity.com/c/fabric" forum, because Twitter staff members are helping there.
just perform client.cancelAuthorize();
when failure occurs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With