Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting authorization error when cancelling from twitter authorization using Fabric SDK

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!

like image 903
Nidhi Shah Avatar asked Mar 14 '15 01:03

Nidhi Shah


2 Answers

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.

like image 154
VadymVL Avatar answered Nov 02 '22 23:11

VadymVL


just perform client.cancelAuthorize(); when failure occurs.

like image 2
Chandan Bhandari Avatar answered Nov 02 '22 22:11

Chandan Bhandari