fix(android-sdk): invalidate unauthenticated sign-out and keep omitted refresh tokens#265
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors to master the two credential-guard hardenings that landed on the v2.x backport PR #264, so the branches stay in lockstep:
abbd42bfrom fix(android-sdk): discard in-flight token responses after sign-out #264):signOut/clearCredentialscalled while not authenticated used to early-return without bumping the credential generation, so a sign-in whose code exchange was still in flight would complete and sign the user in after they had expressed sign-out intent. Both early returns now invalidate pending flows first (new no-argCredentialGuard.invalidate()overload).refreshedToken.refreshToken ?: tokenForRefresh), per RFC 6749 §6. The code-exchange path is intentionally unchanged — a sign-in response without a refresh token still clears any previous one. Unreachable against Logto's own OP (which always returns a refresh token on the refresh grant), but correct per spec and keeps the token-persistence code identical across branches.Testing
unit tests — three new: sign-out-during-unauthenticated-sign-in (both
signOutandclearCredentialsentry points) and refresh-response-without-refresh-token. Red-check verified: exactly these 3 fail on current master, all 45 pass with the fix.Checklist
.changeset(N/A — this repo uses release-please)🤖 Generated with Claude Code