File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
src/commonMain/kotlin/com.adamratzman.spotify Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ import com.adamratzman.spotify.models.SpotifyAuthenticationException
26
26
import com.adamratzman.spotify.models.Token
27
27
import com.adamratzman.spotify.models.TokenValidityResponse
28
28
import com.adamratzman.spotify.models.serialization.toObject
29
- import com.adamratzman.spotify.utils.getCurrentTimeMs
30
29
import com.adamratzman.spotify.utils.toList
31
30
32
31
internal const val base = " https://api.spotify.com/v1"
@@ -70,7 +69,7 @@ abstract class SpotifyApi internal constructor(
70
69
field = value
71
70
}
72
71
val logger = SpotifyLogger (enableLogger)
73
- val expireTime: Long get() = getCurrentTimeMs() + token.expiresIn * 1000
72
+ val expireTime: Long get() = token.expiresAt
74
73
var runExecutableFunctions = true
75
74
76
75
abstract val search: SearchApi
Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ class HttpConnection constructor(
135
135
api != null && api.automaticRefresh
136
136
) {
137
137
api.refreshToken()
138
- return @runBlocking execute(additionalHeaders)
138
+ val newAdditionalHeaders = additionalHeaders?.toMutableList() ? : mutableListOf ()
139
+ newAdditionalHeaders.add(0 , HttpHeader (" Authorization" , " Bearer ${api.token.accessToken} " ))
140
+ return @runBlocking execute(newAdditionalHeaders, retryIf502)
139
141
}
140
142
141
143
return @runBlocking HttpResponse (
You can’t perform that action at this time.
0 commit comments