Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make sure GIDClientID is set in Info.plist new GoogleSignIn IOS version

I'm just trying to configure the new GoogleSignIn IOS and keep getting the error.

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

I've scoured the web and the one or two questions on here for solutions however I can't seem to get this error to clear no matter what. This is in my URL Schemes:

URL Schemes

and this is my Info.plist

info.plist

Does anyone have any examples of exactly how my info.plist should look?

Cheers.

like image 638
user1982365 Avatar asked Oct 17 '25 05:10

user1982365


1 Answers

I've just faced a similar issue when implementing Firebase Authentication w/ GoogleSignIn.

If you think that you will add new property "GIDClientID" into Info.plist of target project, DON'T DO THAT.

Below are the guidelines of Firebase for Authentication w/ Google, this code fixes the issue above but the way it shows how to use signIn method is invalid at this moment:

guard let clientID = FirebaseApp.app()?.options.clientID else { return }

// Create Google Sign In configuration object.
let config = GIDConfiguration(clientID: clientID)

// Start the sign in flow!
GIDSignIn.sharedInstance.signIn(with: config, presenting: self) { [unowned self] user, error in
  // ...
}

There's a solution is to set the configuration to GIDSignIn.sharedInstance before calling signIn method, as below:

guard let clientID = FirebaseApp.app()?.options.clientID else { return }

// Create Google Sign In configuration object.
let config = GIDConfiguration(clientID: clientID)

GIDSignIn.sharedInstance.configuration = config

let scenes = UIApplication.shared.connectedScenes
let windowScenes = scenes.first as? UIWindowScene
let window = windowScenes?.windows.first
guard let rootViewController = window?.rootViewController else { return }

GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController) { signInResult, error in
    // ...
}
like image 96
Tuan Pham Avatar answered Oct 18 '25 21:10

Tuan Pham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!