google / google/GoogleSignIn-iOS

GIDSignInCompletion block not called when ASWebAuthenticationSession is interrupted by device locking

Đang mở
#578 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Objective-C
Star
750
Fork
282
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
9

Mô tả

**Describe the bug**
When using Google Sign-In SDK on iOS, if the user locks their device or the app transitions to background during the authentication flow (while `ASWebAuthenticationSession` is active), the `GIDSignInCompletion` block is never called. This leaves the app in an indefinite loading/blocked state with no way to detect that the session was interrupted or cancelled by the OS.

**To Reproduce**
1. Initiate Google Sign-In flow in an iOS app
2. Wait for the `ASWebAuthenticationSession` system prompt to appear
3. Lock the device before completing authentication
4. Unlock the device and return to the app
5. Observe that the `GIDSignInCompletion` block is never called (no success, no error, no cancellation callback) and the `ASWebAuthenticationSession` alert is dismissed.

**Expected behavior**
The `GIDSignInCompletion` block should be invoked with either:
1. A cancellation result/error indicating the session was interrupted, OR
2. A property that allows detection of this interrupted state

This would allow the host app to reset its UI state (e.g., hide loading indicators, re-enable the sign-in button).

**Screenshots**
N/A.

**Environment**
- Device: iPhone (various models)
- OS: iOS (tested on iOS26, iOS18)
- SDK: Google Sign-In SDK for iOS

**Additional context**
This issue stems from how iOS handles `ASWebAuthenticationSession` interruptions. When the device is locked or the app goes to background, iOS may dismiss the authentication prompt without reliably delivering a cancellation callback to the SDK.
A similar issue has been reported by multiple users in the AppAuth-iOS repository: https://github.com/openid/AppAuth-iOS/issues/468. A fix for the SDK is observing the app's background/foreground state transitions and invoking the completion block if a previously active session was found. We recommend Google Sign-In SDK implement a similar mechanism to detect interrupted sessions and return an appropriate callback to the host application.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi vòng đời của ASWebAuthenticationSession trong SDK và cách các chuyển đổi của ứng dụng giữa nền và tiền cảnh được xử lý. So sánh hành vi khi bị gián đoạn được mô tả ở đây với AppAuth-iOS issue 468. Hoàn thành khi một phiên bị gián đoạn gọi GIDSignInCompletion với một thao tác hủy hoặc lỗi khác có thể phát hiện, để ứng dụng host có thể đặt lại UI của mình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, objective-c
Lĩnh vực
authentication, mobile
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.