Android TweetView Favorite Button Exception com.twitter.sdk.android.core.TwitterAuthException: Twitter login required


#1

Hi,
I receive the following exception when pressing the favorite button on the tweetview actionbar. I’ve followed all of the advice posted on the forum, but have had no luck. I am using Fabric.with to authorize my app at launch, I have added a callback url and have triple checked my app keys. Any insight as to what the issue might be?

Thanks,
Julian

Here is my stacktrace.
E/TweetUi: Twitter login required.
com.twitter.sdk.android.core.TwitterAuthException: Twitter login required.
at com.twitter.sdk.android.tweetui.internal.UserSessionProvider.requestAuth(UserSessionProvider.java:39)
at com.twitter.sdk.android.core.internal.AuthRequestQueue.requestAuth(AuthRequestQueue.java:100)
at com.twitter.sdk.android.core.internal.AuthRequestQueue.addRequest(AuthRequestQueue.java:73)
at com.twitter.sdk.android.tweetui.TweetUiAuthRequestQueue.addClientRequest(TweetUiAuthRequestQueue.java:42)
at com.twitter.sdk.android.tweetui.TweetRepository.favorite(TweetRepository.java:102)
at com.twitter.sdk.android.tweetui.LikeTweetAction.onClick(LikeTweetAction.java:65)
at android.view.View.performClick(View.java:4780)
at com.twitter.sdk.android.tweetui.ToggleImageButton.performClick(ToggleImageButton.java:96)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)


#2

Are you using Fabric’s default login context (guest authentication), or a user context (via a Login button)?

In order to favourite something, you’ll need to be authenticated as a user.


#3

Hi Andy,
Thanks for your help. I figured out what the issue was… it was my misunderstanding of the actionbar capabilities. I assumed if the user wasn’t logged in and pressed the favorite button they would be automatically forwarded to twitter to be authenticate, but that is not the case. I ended up adding an action callback to the favorite button to check if a user wasn’t logged in. If the user isn’t logged in I then make the authorize api call. The trick is to call onActivityResult on the Authenticate Client for the sdk to finish the authentication process. :smile:


#4