Question

In my android application I have created a gmail login.The user can login with the gmail credentials already in the phone.The problem is that I am not getting a valid token in android Gingerbread os.But in the case of ICS and Jelly Bean, I am getting the correct token. I have tested this in about 5 devices.

For checking the validity of the token I used this link

Was it helpful?

Solution

Finally i solved it.The problem is that the token is not getting updated. So for that when ever accessing a token using getAuthtoken

    String authToken=accountManager.getAuthToken(account, SCOPE, false,
                new OnTokenAcquired(), null);

the authToken should be validated using

accountManager.invalidateAuthToken("com.google",
                    bundle.getString(AccountManager.KEY_AUTHTOKEN));

Then again after this you should call

String authTokenNew=accountManager.getAuthToken(account, SCOPE, false, new OnTokenAcquired(), null);

This will be a valied token. You can check the validity of the token from this LINK

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top