2

I am using below code snippet for signin with google, but always returning "The user canceled the sign-in flow"

if GIDSignIn.sharedInstance.hasPreviousSignIn() {
            
    logout()
}else {
    guard let clientID = FirebaseApp.app()?.options.clientID else { return }
    let signInConfig = GIDConfiguration.init(clientID: clientID)
    GIDSignIn.sharedInstance.signIn(with: signInConfig, presenting: getWindowTopController()) { user, error in
                
    guard error == nil else { return }
                
    guard let authentication = user?.authentication,let idToken = authentication.idToken else { return }
 }

Error : Error Domain=com.google.GIDSignIn Code=-5 "The user canceled the sign-in flow." UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.}

Could you please help me to resolve this issue.

bAthi
  • 341
  • 4
  • 20

1 Answers1

0

Try below code

The GIDSignInButton object don't need addTarget in code or linking @IBAction. The GIDSignInButton class already handle that action for us.

Got it from here How to fix `The user canceled the sign-in flow.` with Sign In with Google on iOS?

If above code not works, try the below one

Custom Google Sign-In button - iOS