Skip to content

Instantly share code, notes, and snippets.

@mchowning
Created May 4, 2023 19:20
Show Gist options
  • Save mchowning/0d4edda7247b536a5abccd20357cebb0 to your computer and use it in GitHub Desktop.
Save mchowning/0d4edda7247b536a5abccd20357cebb0 to your computer and use it in GitHub Desktop.
Force access token refresh
diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/SyncManagerImpl.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/SyncManagerImpl.kt
index 2edc42f7..2c2a67fa 100644
--- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/SyncManagerImpl.kt
+++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/SyncManagerImpl.kt
@@ -440,7 +440,8 @@ class SyncManagerImpl @Inject constructor(
private suspend fun <T : Any> getCacheTokenOrLogin(serverCall: suspend (token: AccessToken) -> T): T {
if (isLoggedIn()) {
return try {
- val token = syncAccountManager.getAccessToken() ?: refreshTokenSuspend()
+ // Forcing token refresh for testing purposes
+ val token = refreshTokenSuspend()
serverCall(token)
} catch (ex: Exception) {
// refresh invalid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment