I've a problem with generating a second token in my application. I registered 2 accounts on my phone. When I use the first account token is generating, but when I choose the second token isn't generated. My code:
accountManager.getAuthTokenByFeatures("com.google", "Manage your tasks", null, this,
Bundle.EMPTY, Bundle.EMPTY, new AccountManagerCallback<Bundle>() {
@Override
public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
try {
String token = bundleAccountManagerFuture.getResult()
.getString(AccountManager.KEY_AUTHTOKEN);
Log.e("token", token);
} catch (AuthenticatorException e) {
e.printStackTrace();
} catch (OperationCanceledException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}, null);
I get the following errors:
android.accounts.AuthenticatorException: Unknown android.accounts.AccountManager.convertErrorToException(AccountManager.java:1726) android.accounts.AccountManager.access$400(AccountManager.java:144) android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1572) android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69) android.os.Binder.execTransact(Binder.java:407) dalvik.system.NativeStart.run(Native Method)
The second parameter in getAuthTokenByFeatures
should be a valid scope (eg: oauth2:https://gdata.youtube.com
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With