Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- authtoken = mAccountManager.blockingGetAuthToken(account,
- AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, true);
- Authenticator.java:
- @Override
- public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account,
- String authTokenType, Bundle loginOptions) throws NetworkErrorException {
- // check that authToken type supported
- ...
- // Check if we already have a cached token to return
- final AccountManager am = AccountManager.get(mContext);
- String cachedAuthToken = am.peekAuthToken(account, authTokenType);
- if (cachedAuthToken != null) {
- final Bundle result = new Bundle();
- result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
- result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
- result.putString(AccountManager.KEY_AUTHTOKEN, cachedAuthToken);
- return result;
- }
- // Get new authToken from server
- ...
- // If all else fails, prompt the user for credentials
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement