Skip to content

Commit

Permalink
[FEAT] #339 액세스 토큰 재발급 성공시, preference에 해당 값 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
sxunea committed Mar 14, 2024
1 parent a2d3c2b commit b609e6c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class AuthInterceptor @Inject constructor(
)!!
}

private fun saveToken(accessToken: String, refreshToken: String) {
PreferenceManager.setString(ApplicationClass.appContext, TOKEN_KEY_ACCESS, accessToken)
PreferenceManager.setString(ApplicationClass.appContext, TOKEN_KEY_REFRESH, refreshToken)
}

private fun handleTokenExpired(
chain: Interceptor.Chain,
originalRequest: Request,
Expand Down Expand Up @@ -104,6 +109,7 @@ class AuthInterceptor @Inject constructor(
)
responseToken.data?.data?.let {
Timber.e("New Refresh Token Success: ${it.refreshToken}")
saveToken(it.accessToken, it.refreshToken)
}
}

Expand Down

0 comments on commit b609e6c

Please sign in to comment.