Skip to content

Commit f06e1c1

Browse files
authored
Merge pull request #33 from rogerhu/scribe7
Cleanup
2 parents 418aeb1 + eb01093 commit f06e1c1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/main/java/com/codepath/oauth/OAuthBaseClient.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public abstract class OAuthBaseClient {
2626

2727
private static final String OAUTH1_REQUEST_TOKEN = "request_token";
2828
private static final String OAUTH1_REQUEST_TOKEN_SECRET = "request_token_secret";
29+
private static final String OAUTH1_VERSION = "1.0";
30+
private static final String OAUTH2_VERSION = "2.0";
2931

3032
protected static HashMap<Class<? extends OAuthBaseClient>, OAuthBaseClient> instances =
3133
new HashMap<Class<? extends OAuthBaseClient>, OAuthBaseClient>();
@@ -53,15 +55,15 @@ public OAuthBaseClient(Context c, BaseApi apiInstance, String consumerUrl, Strin
5355
@Override
5456
public void onReceivedRequestToken(Token requestToken, String authorizeUrl, String oAuthVersion) {
5557
if (requestToken != null) {
56-
if (oAuthVersion == "1.0") { // store for OAuth1.0a
58+
if (oAuthVersion == OAUTH1_VERSION) { // store for OAuth1.0a
5759
OAuth1RequestToken oAuth1RequestToken = (OAuth1RequestToken) requestToken;
5860
editor.putString(OAUTH1_REQUEST_TOKEN, oAuth1RequestToken.getToken());
5961
editor.putString(OAUTH1_REQUEST_TOKEN_SECRET, oAuth1RequestToken.getTokenSecret());
6062
editor.commit();
6163
}
6264
}
6365
// Launch the authorization URL in the browser
64-
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(authorizeUrl + "&perms=delete"));
66+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(authorizeUrl));
6567
if (requestIntentFlags != -1) {
6668
intent.setFlags(requestIntentFlags);
6769
}
@@ -72,15 +74,15 @@ public void onReceivedRequestToken(Token requestToken, String authorizeUrl, Stri
7274
@Override
7375
public void onReceivedAccessToken(Token accessToken, String oAuthVersion) {
7476

75-
if (oAuthVersion == "1.0") {
77+
if (oAuthVersion == OAUTH1_VERSION) {
7678
OAuth1AccessToken oAuth1AccessToken = (OAuth1AccessToken) accessToken;
7779

7880
client.setAccessToken(accessToken);
7981
editor.putString(OAuthConstants.TOKEN, oAuth1AccessToken.getToken());
8082
editor.putString(OAuthConstants.TOKEN_SECRET, oAuth1AccessToken.getTokenSecret());
8183
editor.putInt(OAuthConstants.VERSION, 1);
8284
editor.commit();
83-
} else if (oAuthVersion == "2.0") {
85+
} else if (oAuthVersion == OAUTH2_VERSION) {
8486
OAuth2AccessToken oAuth2AccessToken = (OAuth2AccessToken) accessToken;
8587
client.setAccessToken(accessToken);
8688
editor.putString(OAuthConstants.TOKEN, oAuth2AccessToken.getAccessToken());

0 commit comments

Comments
 (0)