Getting authorization error while unauthorizing Twitter using Fabric SDK

I use TwitterKit to log users into the app. I use the custom button in the snippet and TwitterAuthClient to authorize users. A happy input stream works as expected.

However, when I cancel authorization and try to log in again by pressing the login button, I get the following error:

com.twitter.sdk.android.core.TwitterAuthException: Authorize failed. 

I tried to clear the active session and log out before trying to log in a second time after canceling, but this did not solve the problem.

 Twitter.getSessionManager().clearActiveSession(); Twitter.logOut(); 

Any help would be appreciated!

+5
source share
2 answers

Perhaps the problem is that you are using a Fragment, not an Activity, and the Logic login logic cannot go through its life cycle. You cannot try to "recreate" a fragment by replacing an existing one using Fragment transactions when you cancel authorization.

I can not give you more answer because you did not provide your code snippet. Maybe you forgot to add the onActivityResult method? Try also this and this answer. You can also ask questions on this twittercommunity.com/c/fabric forum because the Twitter staff helps there.

+3
source

just do client.cancelAuthorize(); when a failure occurred.

0
source

Source: https://habr.com/ru/post/1215332/


All Articles