Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:04:51+00:00 2026-06-13T13:04:51+00:00

On JellyBean device. I’m following this to request an oauth2 token, e.g. AccountManager am

  • 0

On JellyBean device.

I’m following this to request an oauth2 token, e.g.

AccountManager am = AccountManager.get(getActivity());
am.invalidateAuthToken(MY_AUTH_TOKEN_TYPE, null);
am.getAuthToken(aGoogleAccount, MY_AUTH_TOKEN_TYPE, null, this, 
    new OnTokenAcquired(), new Handler(new OnError()));

and then make the check as per the later code sample:

private class OnTokenAcquired implements AccountManagerCallback<Bundle> {
@Override
    public void run(AccountManagerFuture<Bundle> result) {
        Bundle bundle = result.getResult();
        ...
        Intent launch = (Intent) bundle.get(AccountManager.KEY_INTENT);
        if (launch != null) {
            startActivityForResult(launch, 0);
            return;
        }
    }
}

I never get a KEY_INTENT. I understand the following:

There may be many reasons for the authenticator to return an Intent. It may be the first time the user has logged in to this account. Perhaps the user’s account has expired and they need to log in again, or perhaps their stored credentials are incorrect. Maybe the account requires two-factor authentication or it needs to activate the camera to do a retina scan. It doesn’t really matter what the reason is. If you want a valid token, you’re going to have to fire off the Intent to get it.

However, the getAuthToken always results in the permission screen, or login screen, appearing before the code hits the run method at which point the token is valid. I’ve tried:

  1. Turning on 2 step authentication. Account login is requested before run so always have the token in run.
  2. Changing the password on the server. Again account login is requested before run so always have the token in run.

Don’t have the ability to try a retina scan so somewhat at a loss.

EDIT 1 The problem I have is that there may be a circumstance where I will get a KEY_INTENT and so I’d rather test this code path now rather when when it’s out in the field.

Thanks in advance.

Peter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:04:52+00:00Added an answer on June 13, 2026 at 1:04 pm

    Had a chance to do something similar on a project. This not the exactly the same as your code, and I still say that the callback docs have too many ‘maybes’ to be certain of how it should work, but if you use this method passing false for notifyAuthFailure, you will get an intent with the re-login screen if you change the password or enable 2FA. This is for ClientLogin, but should work similarly for OAuth 2 (not tested though). Something like:

    // using Calendar ClientLogin for simplicity
    Bundle authResult = am.getAuthToken(account, "cl", false, null, null).getResult();
    if (authResult.containsKey(AccountManager.KEY_INTENT)) {
      Intent authIntent = authResult.getParcelable(AccountManager.KEY_INTENT);
      // start activity or show notification
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Datepicker in Android. I get a tottaly Bizzare UI in Jellybean.
Is it just me or is anyone else not seeing the latest Android (Jellybean)
I have created an App and works fine on A real device with Gingerbread
As of #io2012 and JellyBean doc there is now a way to pair bluetooth
This question can be decomposed into multiple smaller problems. The end result would be
I have a weird issue with Jellybean keyboard. When my users upgraded their OS,
We have an application that prints images to a bluetooth printer. This application has
Since Android Jelly Bean doesn't support the logs reading permission (according to this google
Is there anyway to turn off jellybean touch responsiveness. Its causing FPS lag for
--- Note to moderators: Today (July 15), I've noticed that someone already faced this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.