Hope you can help me with this, because I've tried EVERYTHING and the
example in the Google sample code doesn't seem to work.

Scenario:
- An account is created in the AccountManager with a valid username
and password.
- A SyncAdapter is present to deal with server syncs, and successfully
authenticates in the server using the stored credentials through the
AccountManager.
- The user decides to change the password on the server. So, the
password in the Android AccountManager becomes invalid, and we have to
request the user a new password when a synchronization fails with a
401 HTTP error from the server.

According to Google, this can be done. Here's what I understood by
reading the API docs:

1. In the SyncAdapter that extends AbstractThreadedSyncAdapter, when
we request the AuthToken, we set the notifyAuthFailure to false:

String authtoken = accountManager.blockingGetAuthToken(account,
Constants.AUTHTOKEN_TYPE, false);

2. In the Authenticator that extends AbstractAccountAuthenticator, we
return the following in the getAuthToken method:

final Intent intent = new Intent(context,
AuthenticatorActivity.class);
intent.putExtra(AuthenticatorActivity.PARAM_USERNAME, account.name);
intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE,
authTokenType);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
response);
final Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;

This should call the AuthenticatorActivity defined in the Intent, but
it doesn't. It just invokes the getAuthToken method again.

I've tried calling directly from the from the SyncAdapter the methods
confirmCredentials and updateCredentials, but they will never launch
the AuthenticatorActivity.

What I'm I doing wrong?!
How can we request the Authenticator to show an Activity to ask for a
new password?

In all examples that I've seen, they all assume that the credentials,
once they are valid, then they will never change.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to