Android App asks permission every time

signin

#1

Hi,
I am using twitter sign in in my android app.
Everytime the user tries sign in, the authorization class appears. Is this normal? Shouldn’t it automatically redirect to the (MainActivity etc.) if the user is already signed in? Or is it something I did wrong?


#2

The way I’m using sign in is like;

public void onTwitterButtonClicked(View v) {

    mTwitterAuthClient.authorize(this, new com.twitter.sdk.android.core.Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> twitterSessionResult) {
			System.out.println("token: " + twitterSessionResult.data.getAuthToken().token);
			System.out.print("secret: " + twitterSessionResult.data.getAuthToken().secret);
		}

        @Override
        public void failure(com.twitter.sdk.android.core.TwitterException exception) {
            exception.printStackTrace();
			onTwitterLoginFailed(exception);
        }
    });
}

#3

(moved to Twitter Kit SDK category)


#4

Bumping this I want an answer too. Using example code found in the sample

Everything works except app asks permission every time which is disrupting the usage flow.

It’s a little annoying to authorize the app every time and then create a post/etc.

Edit: Feeling dumb for bumping a year old thread but this is the first page on google when googling the problem and TO BE FAIR IT SAYS FEBRUARY 17 i didn’t know 17 was the year anyway i found the answer.

you can save the Session by serializing/deserializing for anyone wondering. As long as the user has not revoked permissions it will work but dangerous if the oauth becomes invalid. So far I havent found a way to check if the session is still valid within the SDK so what i did is set up the API error call back on the post method to re-authenticate the user’s session

TLDR: Serialize session and load it instead of loging in again