title: Google Sign In Button error when trying to login
body: <p>I have followed all the steps of the Firebase instructions for adding a Google Sign In Button. I have two problems when I open the app I have to wait a couple of minutes before pressing the Google button otherwise it gives me an error, after the first sign in if I try more still gives me the error.
  (I added all the pods, all the app delegate function requested, the url in the target section of the app, the google.key-value list, and tried all possible solutions from other similar questions)
  The errors I get are</p>
  <blockquote>
  <p>Optional(Error Domain=com.google.GIDSignIn Code=-5 &quot;The user canceled the sign-in flow.&quot; UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.})</p>
  </blockquote>
  <p>Please if someone could help, cause I tried all stack overflow and google possibilities, and still not working.</p>
  <p>Here is snippet of my code:</p>
  <pre><code>    import Firebase
      import GoogleSignIn
  
  
      class ViewController: UIViewController {
  
      var googleButton : GIDSignInButton!
       viewDidLoad(){
       self.googleButton = GIDSignInButton()
       self.googleButton.style = .iconOnly
      self.googleButton.frame = CGRect(x: 120, y: 300, width: 75, height: 75)
      self.googleButton.addTarget(self, action: #selector(configureGoogleButton),        for: .allTouchEvents)
      
      
      self.view.addSubview(self.googleButton)
  
       }
  
        function configureGoogleButton(){
  
      //get client Id
      guard let clientID = FirebaseApp.app()?.options.clientID else {return}
      let config = GIDConfiguration(clientID: clientID)
         
      
  GIDSignIn.sharedInstance.signIn(with: config, presenting: self)
      { user,error in
  
          guard error == nil else {
              print(&quot;The app is not working&quot;)
              print(error)
              return }
  
           guard
             let authentication = user?.authentication,
             let idToken = authentication.idToken
           else {
             return
           }
  
           let credential = GoogleAuthProvider.credential(withIDToken: idToken,
                                                          accessToken: authentication.accessToken)
          
          
          self.googleCredential = credential
          print(user?.profile?.email)
          print(user?.profile?.name)
         
  </code></pre>
  <p>}</p>
  <p>Here is part of the app delegate:</p>
  <pre><code>     import Firebase
        import UIKit
        import GoogleSignIn
  
      @main
      class AppDelegate: UIResponder, UIApplicationDelegate {
  
  
  
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {
      // Override point for customization after application launch.
      
      FirebaseApp.configure()
      return true
      
      
  }
  
  // MARK: UISceneSession Lifecycle
  
  func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -&gt; UISceneConfiguration {
      // Called when a new scene session is being created.
      // Use this method to select a configuration to create the new scene with.
      return UISceneConfiguration(name: &quot;Default Configuration&quot;, sessionRole: connectingSceneSession.role)
  }
  
     func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set&lt;UISceneSession&gt;) {
      // Called when the user discards a scene session.
      // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
      // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
  }
  
  
  
     func application(
    _ app: UIApplication,
    open url: URL, options: [UIApplication.OpenURLOptionsKey :         Any] = [:]
  ) -&gt; Bool {
      
    var handled: Bool
  
    handled = GIDSignIn.sharedInstance.handle(url)
    if handled {
      return true
    }
  
    // Handle other custom URL types.
  
    // If not handled by this app, return false.
    return false
  }
  </code></pre>
  <p>}</p>