skip to Main Content

I was rebuilding pet IOS project with google and facebook authorization. Google flow used to be like:

GIDSignIn.sharedInstance.signIn(with: config, presenting: presentingViewController) {

        user, error in ///bla bla bla }

But when the GoogleSignIn package was redownloaded, xcode started showing an error. And google authorization flow changed to

GIDSignIn.sharedInstance.signIn(withPresenting: presentingViewController) {

            user, error in ///bla bla bla }

The problem is when I’m doing auth in this "new" way my app crashes with message

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'No active configuration.  Make sure GIDClientID is set in Info.plist.'

Also there is no information in google documentation and in github rep. Please help!

2

Answers


  1. The function updated and with: config parameter removed. Client_ID value from googleservice-info should be added info.plist as GIDClientID key. your function should be

    func googleSign(){
      
        
        guard let presentingVC = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.first?.rootViewController else {return}
        // Start the sign in flow!
        GIDSignIn.sharedInstance.signIn(withPresenting: presentingVC) { user, error in
            if let error = error {
                print(error.localizedDescription)
                return
              }
    
              guard let authentication = user?.authentication, let idToken = authentication.idToken
              else {
                return
              }
    
              let credential = GoogleAuthProvider.credential(withIDToken: idToken,
                                                             accessToken: authentication.accessToken)
            self.showCustomAlertLoading = true
            Auth.auth().signIn(with: credential) { authResult, error in
                guard let user = authResult?.user, error == nil else {
                    self.signUpResultText = error?.localizedDescription ?? "Error Occured"
                    DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
                        self.showCustomAlertLoading = false
                    })
                    return}
                self.signUpResultText = "(user.email!)nSigning Succesfully"
                self.isSignUpSucces = true
                DispatchQueue.main.asyncAfter(deadline: .now() + 3, execute: {
                    self.showCustomAlertLoading = false
                    DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
                        self.navigateHome = true
                    })
                })
                print("(user.email!) signed****")
                
            }
        }
    }
    
    Login or Signup to reply.
  2. Make sure you are downloading version 6.0.2 in order to get GIDSignIn.sharedInstance.signIn(with: presenting: callback)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search