Unable perform google plus sign in ios using ionic 2

Viewed 1172

Hi i am applying social login scenario in my ionic app where i applied google sign option and it is working perfectly with android and when comming to the ios im getting the below error

the api key and bundle id everything are set and working perfect

ios google plus error

2 Answers

You have to follow the below steps as configuration for google login through IOS

  1. Go to https://developers.google.com/mobile/add?platform=ios&cntapi=signin for IOS registration
  2. Enter IOS bundle Id from widget Id in config.xml of the project
  3. Enable Google sign In and generate configuration file
  4. Copy the reverse client Id from downloaded file
  5. Install the plugin with reverse client Id instead of webclient Id which we used for Android
  6. run cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID="myreversedclientid" We can find the reverse client Id in Google developer console also credentials->iOS URL schema is the reverse client Id

Extract from Plugin documentation

To get your iOS REVERSED_CLIENT_ID, generate a configuration file here. This GoogleService-Info.plist file contains the REVERSED_CLIENT_ID you'll need during installation. This value is only needed for iOS.

The REVERSED_CLIENT_ID is also known as the "iOS URL Scheme" on the Developer's Console.

Login on iOS takes the user to a SafariViewController through the Google SDK, instead of the separate Safari browser.

IMPORTANT:

  1. Please note that myreversedclientid is a place holder for the reversed clientId you find in your iOS configuration file. Do not surround this value with quotes. (iOS only Applications)

  2. If you are building a hybrid application (iOS and Android), or an Android application, you have to replace myreversedclientid with the reverse value of Client ID in your Release credential generated on step 3, on Google Developer's Console, this will be: "com.googleusercontent.apps.uniqueId", without quotes.

1)Go to firebase console in your project add for ios.

2)you can see the google-info-plist file download it.

3)in this plist file have webclientid and reverseclientid use this in package json file where google plus varible of webclient id and reverseclient id.same as in config.xml file then after.

4)run commnad ionic cordova prepare ios then ionic cordova build ios

5)buy beer for me :)

Related