Skip to content

Commit

Permalink
[Updated] Spotify OAuth library
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhPatange committed Jun 8, 2020
1 parent 41427ad commit d2e0bfc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/spotifyapi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "0.13"
versionName "0.15"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand All @@ -46,7 +46,7 @@ dependencies {

implementation 'androidx.activity:activity-ktx:1.2.0-alpha05'

implementation 'com.spotify.android:auth:1.1.0'
implementation 'com.spotify.android:auth:1.2.3'

// OkHttp
implementation 'com.squareup.okhttp3:okhttp:3.1.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import androidx.activity.result.contract.ActivityResultContracts
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.kpstv.spotifyapi.enumerations.Scopes
import com.spotify.sdk.android.authentication.LoginActivity
import com.spotify.sdk.android.auth.LoginActivity
import okhttp3.*
import java.io.IOException
import java.util.*
Expand Down Expand Up @@ -54,8 +54,8 @@ class SpotifyClient(
* This flow will generate access_token and refresh_token.
*/
fun invokeAuthorizationFlow(): Unit = with(activity) {
val builder = com.spotify.sdk.android.authentication.AuthenticationRequest.Builder(
CLIENT_ID, com.spotify.sdk.android.authentication.AuthenticationResponse.Type.CODE,
val builder = com.spotify.sdk.android.auth.AuthorizationRequest.Builder(
CLIENT_ID, com.spotify.sdk.android.auth.AuthorizationResponse.Type.CODE,
REDIRECT_URI
)

Expand Down Expand Up @@ -85,19 +85,19 @@ class SpotifyClient(
responseAction: ResponseAction<AuthResponse>?
) {
if (requestCode == AUTHORIZATION_REQUEST_CODE) {
val response = com.spotify.sdk.android.authentication.AuthenticationClient.getResponse(
val response = com.spotify.sdk.android.auth.AuthorizationClient.getResponse(
resultCode,
data
)
when (response.type) {
com.spotify.sdk.android.authentication.AuthenticationResponse.Type.CODE -> {
com.spotify.sdk.android.auth.AuthorizationResponse.Type.CODE -> {
val authToken = response.code
makeAResponse(
"grant_type=authorization_code&code=$authToken&redirect_uri=$REDIRECT_URI"
, responseAction
)
}
com.spotify.sdk.android.authentication.AuthenticationResponse.Type.ERROR -> {
com.spotify.sdk.android.auth.AuthorizationResponse.Type.ERROR -> {
responseAction?.onError(Exception("Authentication is denied"))
}
else ->
Expand Down
4 changes: 2 additions & 2 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ afterEvaluate {
url = 'https://github.com/KaustubhPatange/Unofficial-Spotify-SDK'
licenses {
license {
name = 'GNU General Public License, Version 3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
Expand Down

0 comments on commit d2e0bfc

Please sign in to comment.