فهرست منبع

Update: refresh token data add serialized name

liweihao 6 سال پیش
والد
کامیت
ce328f9dc3

+ 1 - 1
src/main/java/com/example/bomocloud/TokenAuthenticator.kt

@@ -19,7 +19,7 @@ class TokenAuthenticator(private val boMoCloud: BoMoCloud) : okhttp3.Authenticat
 
             boMoCloud.oAuthService.refreshToken(GRANT_TYPE, it)
                     .subscribe({
-                        accessToken = it.access_token
+                        accessToken = it.accessToken
                     }, {
                         it.printStackTrace()
                     })

+ 7 - 5
src/main/java/com/example/bomocloud/auth/RefreshTokenData.kt

@@ -1,10 +1,12 @@
 package com.example.bomocloud.auth
 
+import com.google.gson.annotations.SerializedName
+
 
 data class RefreshTokenData(
-        val access_token: String,
-        val token_type: String,
-        val expires_in: Int,
-        val refresh_token: String,
-        val created_at: Int
+        @SerializedName("access_token") val accessToken: String,
+        @SerializedName("token_type") val tokenType: String,
+        @SerializedName("expires_in") val expiresIn: Int,
+        @SerializedName("refresh_token") val refreshToken: String,
+        @SerializedName("created_at") val createdAt: Int
 )