Skip to content

Commit 275d6f3

Browse files
committed
[#228] Remove redundant functions in SessionManager
1 parent 8a867f0 commit 275d6f3

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

template-xml/data/src/main/java/co/nimblehq/template/xml/data/service/SessionManager.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,5 @@ interface SessionManager {
88

99
suspend fun getRefreshToken(): String
1010

11-
suspend fun getRegistrationToken(): String
12-
13-
suspend fun getTokenType(): String
14-
1511
suspend fun refresh(authenticateResponse: AuthenticateResponse)
1612
}

template-xml/data/src/main/java/co/nimblehq/template/xml/data/service/authenticator/ApplicationRequestAuthenticator.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ class ApplicationRequestAuthenticator(
4040
} else {
4141
retryCount++
4242

43-
val tokenType = sessionManager.getTokenType()
4443
val failedAccessToken = sessionManager.getAccessToken()
4544

4645
try {
47-
val refreshTokenResponse = tokenRefresher.refreshToken().last().copy(
48-
// refreshToken response doesn't send tokenType
49-
tokenType = tokenType
50-
)
46+
val refreshTokenResponse = tokenRefresher.refreshToken().last()
5147
val newAccessToken = refreshTokenResponse.accessToken
5248

5349
if (newAccessToken.isEmpty() || newAccessToken == failedAccessToken) {
@@ -61,7 +57,7 @@ class ApplicationRequestAuthenticator(
6157
// Retry this failed request (401) with the new token
6258
return@runBlocking response.request
6359
.newBuilder()
64-
.header(REQUEST_HEADER_AUTHORIZATION, "$tokenType $newAccessToken")
60+
.header(REQUEST_HEADER_AUTHORIZATION, newAccessToken)
6561
.build()
6662
} catch (e: Exception) {
6763
Log.w("AUTHENTICATOR", "Failed to refresh token: $e")

0 commit comments

Comments
 (0)