Only one token per request is possible so use `header` instead of `addHeader`
This commit is contained in:
parent
4cbb2f7d9d
commit
8cc12fb8d4
|
@ -25,10 +25,10 @@ internal class AccessTokenInterceptor(private val accessTokenProvider: AccessTok
|
|||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
var request = chain.request()
|
||||
|
||||
accessTokenProvider.getToken()?.let {
|
||||
val newRequestBuilder = request.newBuilder()
|
||||
// Add the access token to all requests if it is set
|
||||
newRequestBuilder.addHeader(HttpHeaders.Authorization, "Bearer $it")
|
||||
accessTokenProvider.getToken()?.let { token ->
|
||||
val newRequestBuilder = request.newBuilder()
|
||||
newRequestBuilder.header(HttpHeaders.Authorization, "Bearer $token")
|
||||
request = newRequestBuilder.build()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue