Skip to content

Commit

Permalink
🐛 adding Bearer prefix when getting access token from data store
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkim2689 committed Aug 6, 2024
1 parent 26fc5be commit e9fcf6b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ class DefaultSessionLocalDataSource(
}

override suspend fun updateAccessToken(accessToken: String?) {
dataStore.modifyValue(KEY_ACCESS_TOKEN, accessToken)
val token =
if (accessToken != null) {
"${PREFIX_BEARER_TOKEN}$accessToken"
} else {
null
}
dataStore.modifyValue(KEY_ACCESS_TOKEN, token)
}

override suspend fun updateRefreshToken(refreshToken: String?) {
Expand Down Expand Up @@ -89,6 +95,7 @@ class DefaultSessionLocalDataSource(

companion object {
private const val TAG = "DefaultAuthorizationLocalDataSource"
private const val PREFIX_BEARER_TOKEN = "Bearer "
private const val EXCEPTION_ERROR_READING_EXCEPTION = "Error reading preferences."
private val KEY_ACCESS_TOKEN = stringPreferencesKey("access_token")
private val KEY_REFRESH_TOKEN = stringPreferencesKey("refresh_token")
Expand Down

0 comments on commit e9fcf6b

Please sign in to comment.