0

I'm new and only developpeur in my company and they tasked my with clearing some bugs with their mobile app.

I'm working with an Ionic app and we have google login option for our users, using cordova plugin "cordova-plugin-googleplus".

The problem I'm having is the user tokenId I get from google doesn't work when I send it to my API using "google-api-php-client" library v1.1.5 :
- When the tokenId comes from an Android device, the connection works, the azp and aud in the token have a different value, one is the Android client ID and the other the web client id.
- When the tokenId comes from an iOS device, the connection doesn't work, the azp and aud both have the iOS client id value.

So in iOS case when google api php library checks the tokenId against the client id in my config it fails as the config give the web client id.

I have a couple questions, is it normal that the tokenId for iOS doesn't have the web client ID as the Android one ? And is possible in the config to allow more than one client ID ? (So I could allow both the web client ID and the iOS ID)

Thanks for any advice !

1 Answers1

0

I found out the answer

Apparently for iOS if you don't add the option 'offline' : 'true' when calling the google login it doesn't use the webClientID you specified. Not sure why it does that for iOS and not for Android though

It's in GooglePlus.m :

NSString* serverClientId = options[@"webClientID"];
...
if (serverClientId != nil && offline) {
    signIn.serverClientID = serverClientId;
}

I'm still interested into why the different behavior for iOS and Android or if it's a bug, but hopefully this will help someone else someday