mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Only one token per request is possible so use header
instead of addHeader
This commit is contained in:
parent
4cbb2f7d9d
commit
8cc12fb8d4
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
// Add the access token to all requests if it is set
|
||||
accessTokenProvider.getToken()?.let { token ->
|
||||
val newRequestBuilder = request.newBuilder()
|
||||
// Add the access token to all requests if it is set
|
||||
newRequestBuilder.addHeader(HttpHeaders.Authorization, "Bearer $it")
|
||||
newRequestBuilder.header(HttpHeaders.Authorization, "Bearer $token")
|
||||
request = newRequestBuilder.build()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue