Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Commit c6830dd

Browse files
authored
Merge pull request #7 from Ashok28/bugfix/error_handling
Added error handling for user cancelling flow
2 parents 8f8a077 + 2e350f2 commit c6830dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/OpenGoogleSignInSDK/OpenGoogleSignInSDK.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ public final class OpenGoogleSignIn: NSObject {
106106
url: authURL,
107107
callbackURLScheme: clientID
108108
) { [weak self] callbackURL, error in
109-
guard let callbackURL = callbackURL else { return }
109+
guard let callbackURL = callbackURL else {
110+
if error != nil {
111+
// No callback URL with error means user cancelled the flow
112+
self?.delegate?.sign(didSignInFor: nil, withError: .userCancelledSignInFlow)
113+
}
114+
return
115+
}
110116

111117
if let error = error {
112118
// Throw error if received

0 commit comments

Comments
 (0)