/** * Shows keeping the access keys returned from Trusted Authenticator in a local store, rather than * storing user name & password, and re-authenticating each time (which is not to be done, ever). */ private void loadAuth(AndroidAuthSession session) { SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0); String key = prefs.getString(ACCESS_KEY_NAME, null); String secret = prefs.getString(ACCESS_SECRET_NAME, null); if (key == null || secret == null || key.length() == 0 || secret.length() == 0) return; if (key.equals("oauth2:")) { // If the key is set to "oauth2:", then we can assume the token is for OAuth 2. session.setOAuth2AccessToken(secret); } else { // Still support using old OAuth 1 tokens. session.setAccessTokenPair(new AccessTokenPair(key, secret)); } }