Google SignIn - Always return "The user canceled the sign-in flow"

Viewed 535

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.

1 Answers
Related