Skip to content

Conversation

TizioIncognito
Copy link

No description provided.

@filipkowicz
Copy link

in kotlin you can easily do it with extension and suspendable method:

internal suspend fun AuthState.performActionWithFreshTokens(service: AuthorizationService): String =
        suspendCancellableCoroutine { cont ->
            performActionWithFreshTokens(service) { accessToken, idToken, ex ->
                if(accessToken != null) {
                    cont.resume(accessToken)
                } else {
                    cont.cancel(ex)
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants