TF-2871 Use refreshToken again when the new refreshToken is null

This commit is contained in:
dab246
2024-06-04 16:58:37 +07:00
committed by Dat H. Pham
parent d2ee12c2ae
commit 54e11a61e6
@@ -36,15 +36,16 @@ class AuthenticationInterceptor: RequestInterceptor {
} }
handleRefreshToken(tokenRefreshManager: tokenRefreshManager) { tokenResponse in handleRefreshToken(tokenRefreshManager: tokenRefreshManager) { tokenResponse in
guard let accessToken = tokenResponse.accessToken, guard let accessToken = tokenResponse.accessToken else {
let refreshToken = tokenResponse.refreshToken else {
return completion(.doNotRetryWithError(error)) return completion(.doNotRetryWithError(error))
} }
let newRefreshToken = tokenResponse.refreshToken ?? authenticationSSO.refreshToken
self.authentication = AuthenticationSSO( self.authentication = AuthenticationSSO(
type: AuthenticationType.oidc, type: AuthenticationType.oidc,
accessToken: accessToken, accessToken: accessToken,
refreshToken: refreshToken, refreshToken: newRefreshToken,
expireTime: "\(tokenResponse.expiresTime ?? 0)" expireTime: "\(tokenResponse.expiresTime ?? 0)"
) )
@@ -54,7 +55,7 @@ class AuthenticationInterceptor: RequestInterceptor {
token: accessToken, token: accessToken,
tokenId: tokenResponse.tokenId, tokenId: tokenResponse.tokenId,
expiredTime: "\(tokenResponse.expiresTime ?? 0)", expiredTime: "\(tokenResponse.expiresTime ?? 0)",
refreshToken: refreshToken refreshToken: newRefreshToken
) )
) )