Can't get google login to work in an IOS build

Flushed with my success in getting google login to work on Android, I am now struggling with IOS. Here’s what I’ve done:

  • Added the google plus plugin: meteor add cordova:cordova-plugin-googleplus@8.4.0
  • Created an IOS type Oauth 2.0 client ID in my google developer console specifying:
    A) The Bundle ID (as per my reverse domain path I have for my app - and set as the id property in App.info() of my mobile-config.js
    B) The Team ID that is my Apple developer account
  • Using the IOS URL scheme as provided by the above Oauth 2.0 client ID I set up this entry in my mobile-config.js:
App.configurePlugin('cordova-plugin-googleplus', {
    REVERSED_CLIENT_ID: 'com.googleusercontent.apps.BigLongAlphanumericString'
});

By my reckoning that should work. But when I try it in an IOS beta release (i.e. against a production server), Google’s popup auth window entitled “accounts.google.com” tells my I have an Authorisation error giving a “401: invalid client”.

I have 2 questions:

  1. Does anyone have any ideas as to how I can trace/debug this so I can see what is being sent to google?
  2. At what point does the REVERSED_CLIENT_ID as set in my mobile-config.js get ingested (I know, for example, that you cannot add the cordova-plugin-googleplus plugin unless this exists - perhaps it gets set up when you add the package?). I cannot find any evidence of it in the Xcode project, or in the .meteor folder or anywhere - making me think that it’s not getting sucked in - which would explain the google auth error
  3. OK, 3 questions: Can anyone see what I am doing wrong or what I’m missing out?

Thanks, as ever

I see in a project that I didn’t touch for 1.5 years I have this in mobile-config which could be based on this: https://firebase.google.com/docs/ios/setup

I supposed you successfully installed the pods in Xcode.

App.appendToConfig(`
<platform name="ios">
  <resource-file target="GoogleService-Info.plist" src="../../../cordova-build-override/GoogleService-Info.plist"/>
</platform>
`)

@paulishca , you are a lifesaver!

Yes, I can confirm that adding the above to my config worked.

So in addition to my list in my initial post, you need to also download the .plist file from the google developer console and put it somewhere in your project. Then add this to your mobile-config.js:

App.appendToConfig(`
<platform name="ios">
  <resource-file target="GoogleService-Info.plist" src="../../../pathAndNameOfYourDownloadedPlistFileFromGoogle"/>
</platform>
`)

Note that you do not have to set up a project or anything in google Firebase, the only thing you need to set up in Google (just as is the case for Android and Web) is to set up a suitable Oauth 2.0 client ID in the developer console.

You still need to have the REVERSED_CLIENT_ID entry in your mobile-config.js file, though this seems somewhat duplicative as that information and more is in the downloaded plist file.

So something about the way Meteor and/or Cordova treat the plugin configuration seems to have gone awry and the platform entry sorts it out.

Many thanks @paulishca

1 Like

You’re very welcome. I am glad this fixed it. I think you asked initially where you can see the debug log for IOS development. That is in Xcode when you start the app on device or simulator.

Yes, thanks for that … I did see that but details as to the failed google login were not in evidence.

Thanks again