From e72ea942ea0feb1d985ca0716a9fc588c70fb138 Mon Sep 17 00:00:00 2001 From: lgleasain Date: Mon, 28 Jun 2021 20:52:53 -0400 Subject: [PATCH] adding in changes so that this will work with api 30 --- library/build.gradle | 14 +++++++------- .../java/com/codepath/oauth/OAuthTokenClient.java | 10 +++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index d0c6189..842e033 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -32,13 +32,13 @@ group = GROUP archivesBaseName = POM_ARTIFACT_ID android { - compileSdkVersion 28 + compileSdkVersion 30 defaultConfig { versionCode 1 versionName VERSION_NAME minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 30 } // Related to https://github.com/scribejava/scribejava/issues/480 @@ -90,18 +90,18 @@ ext { } dependencies { - api "androidx.appcompat:appcompat:1.0.2" - api 'com.codepath.libraries:asynchttpclient:0.0.8' + api "androidx.appcompat:appcompat:1.3.0" + api 'com.codepath.libraries:asynchttpclient:2.1.1' api 'com.github.scribejava:scribejava-apis:4.1.1' api 'com.github.scribejava:scribejava-httpclient-okhttp:4.1.1' implementation 'se.akerfeldt:okhttp-signpost:1.1.0' implementation 'oauth.signpost:signpost-core:1.2.1.2' implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1' - implementation "com.squareup.okhttp3:logging-interceptor:4.1.0" + implementation "com.squareup.okhttp3:logging-interceptor:4.7.2" } -/*task jar(type: Jar) { +task jar(type: Jar) { from android.sourceSets.main.java.srcDirs -}*/ +} diff --git a/library/src/main/java/com/codepath/oauth/OAuthTokenClient.java b/library/src/main/java/com/codepath/oauth/OAuthTokenClient.java index 03629b4..d76079d 100755 --- a/library/src/main/java/com/codepath/oauth/OAuthTokenClient.java +++ b/library/src/main/java/com/codepath/oauth/OAuthTokenClient.java @@ -34,12 +34,20 @@ public OAuthTokenClient(BaseApi apiInstance, String consumerKey, String consumer this.apiInstance = apiInstance; this.handler = handler; if (callbackUrl == null) { callbackUrl = OAuthConstants.OUT_OF_BAND; }; - this.service = new ServiceBuilder() + if(scope == null) { + this.service = new ServiceBuilder() + .apiKey(consumerKey) + .apiSecret(consumerSecret).callback(callbackUrl) + .httpClientConfig(OkHttpHttpClientConfig.defaultConfig()) + .build(apiInstance); + } else { + this.service = new ServiceBuilder() .apiKey(consumerKey) .apiSecret(consumerSecret).callback(callbackUrl) .httpClientConfig(OkHttpHttpClientConfig.defaultConfig()) .scope(scope) // OAuth2 requires scope .build(apiInstance); + } } // Get a request token and the authorization url