@@ -62,6 +62,7 @@ public void onReceivedRequestToken(Token requestToken, String authorizeUrl, Stri
62
62
OAuth1RequestToken oAuth1RequestToken = (OAuth1RequestToken ) requestToken ;
63
63
editor .putString (OAUTH1_REQUEST_TOKEN , oAuth1RequestToken .getToken ());
64
64
editor .putString (OAUTH1_REQUEST_TOKEN_SECRET , oAuth1RequestToken .getTokenSecret ());
65
+ editor .putInt (OAuthConstants .VERSION , 1 );
65
66
editor .commit ();
66
67
}
67
68
}
@@ -141,7 +142,7 @@ public void authorize(Uri uri, OAuthAccessHandler handler) {
141
142
this .accessHandler = handler ;
142
143
if (checkAccessToken () == null && uri != null ) {
143
144
// TODO: check UriServiceCallback with intent:// scheme
144
- tokenClient .fetchAccessToken (checkAccessToken (), uri );
145
+ tokenClient .fetchAccessToken (getOAuth1RequestToken (), uri );
145
146
146
147
} else if (checkAccessToken () != null ) { // already have access token
147
148
this .accessHandler .onLoginSuccess ();
@@ -165,10 +166,15 @@ protected OAuthTokenClient getTokenClient() {
165
166
return tokenClient ;
166
167
}
167
168
168
- // Returns the request token stored during the request token phase
169
- protected OAuth1RequestToken getOAuth1RequestToken () {
170
- return new OAuth1RequestToken (prefs .getString (OAUTH1_REQUEST_TOKEN , "" ),
171
- prefs .getString (OAUTH1_REQUEST_TOKEN_SECRET , "" ));
169
+ // Returns the request token stored during the request token phase (OAuth1 only)
170
+ protected @ Nullable Token getOAuth1RequestToken () {
171
+ int oAuthVersion = prefs .getInt (OAuthConstants .VERSION , 0 );
172
+
173
+ if (oAuthVersion == 1 ) {
174
+ return new OAuth1RequestToken (prefs .getString (OAUTH1_REQUEST_TOKEN , "" ),
175
+ prefs .getString (OAUTH1_REQUEST_TOKEN_SECRET , "" ));
176
+ }
177
+ return null ;
172
178
}
173
179
174
180
// Assigns the base url for the API
0 commit comments