@@ -62,6 +62,7 @@ public void onReceivedRequestToken(Token requestToken, String authorizeUrl, Stri
6262 OAuth1RequestToken oAuth1RequestToken = (OAuth1RequestToken ) requestToken ;
6363 editor .putString (OAUTH1_REQUEST_TOKEN , oAuth1RequestToken .getToken ());
6464 editor .putString (OAUTH1_REQUEST_TOKEN_SECRET , oAuth1RequestToken .getTokenSecret ());
65+ editor .putInt (OAuthConstants .VERSION , 1 );
6566 editor .commit ();
6667 }
6768 }
@@ -141,7 +142,7 @@ public void authorize(Uri uri, OAuthAccessHandler handler) {
141142 this .accessHandler = handler ;
142143 if (checkAccessToken () == null && uri != null ) {
143144 // TODO: check UriServiceCallback with intent:// scheme
144- tokenClient .fetchAccessToken (checkAccessToken (), uri );
145+ tokenClient .fetchAccessToken (getOAuth1RequestToken (), uri );
145146
146147 } else if (checkAccessToken () != null ) { // already have access token
147148 this .accessHandler .onLoginSuccess ();
@@ -165,10 +166,15 @@ protected OAuthTokenClient getTokenClient() {
165166 return tokenClient ;
166167 }
167168
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 ;
172178 }
173179
174180 // Assigns the base url for the API
0 commit comments