Skip to content

Fix sign-in completion after interrupted authentication session#601

Open
ademirev wants to merge 1 commit into
google:mainfrom
ademirev:fix/interrupted-auth-session-completion
Open

Fix sign-in completion after interrupted authentication session#601
ademirev wants to merge 1 commit into
google:mainfrom
ademirev:fix/interrupted-auth-session-completion

Conversation

@ademirev
Copy link
Copy Markdown

@ademirev ademirev commented Jun 2, 2026

Fixes #578

ASWebAuthenticationSession can be dismissed after device lock/backgrounding without AppAuth invoking its callback, leaving GIDSignInCompletion pending.

This observes app lifecycle during interactive iOS sign-in and cancels the still-pending AppAuth flow after the app returns active if the flow had entered the background and has not completed. The cancellation goes through AppAuth's existing session cancel path, preserving the existing mapping to kGIDSignInErrorCodeCanceled.

Testing:

  • Added unit coverage for interrupted auth cancellation, completed-flow race, and active-without-background behavior.
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme GoogleSignIn-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' test -only-testing:GoogleSignIn-UnitTests/GIDSignInTest
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme GoogleSignIn-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' build-for-testing
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme GoogleSignIn-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' test-without-building
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme GoogleSignIn-Package -sdk macosx -destination 'platform=macOS,arch=arm64' build-for-testing
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme GoogleSignIn-Package -sdk macosx -destination 'platform=macOS,arch=arm64' test-without-building
  • git diff --check

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.

GIDSignInCompletion block not called when ASWebAuthenticationSession is interrupted by device locking

1 participant