EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
566 stars 626 forks source link

How to generate Reverse Client Id #423

Open karthikrajender opened 7 years ago

karthikrajender commented 7 years ago

Hi All,

cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=myreversedclientid

kindly tell me how can i add a myreverseclientid - i am developing a hybrid application for both IOS and Android and also the same time i need to get id token from sign in process so i have given

window.plugins.googleplus.login( { 'scopes': '... ', // optional, space-separated list of scopes, If not included or empty, defaults to profile and email. 'webClientId': 'client id of the web app/server side', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required. 'offline': true, // optional, but requires the webClientId - if set to true the plugin will also return a serverAuthCode, which can be used to grant offline access to a non-Google server }, function (obj) { alert(JSON.stringify(obj)); // do something useful instead of alerting }, function (msg) { alert('error: ' + msg); } );

i have given web client id as in the above code, but what is my reverse client how can i generate it for both hybrid application both IOS and Android.

karthikrajender commented 7 years ago

Thanks for the reply ... for hybrid application how can i do it .. both IOS and Android i need to give seperate client id or same id for both As per EddyVerbruggen on step 3: REVERSED_CLIENT_ID should be given for only ios but at the time of plugin installation

cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=myreversedclientid

in the above command i can give it for ios but for android which reverse client id i need to give say i have done the below command to do it for android seperately $ keytool -exportcert -keystore -list -v -alias

@EddyVerbruggen one kind request if you can able to make a video tutorial regarding this will me much more useful to helpful to every one.

amit777 commented 7 years ago

@karthikrajender Android does not use the reverse client id. The android steps are different and do not require any parameter to be passed in during the plugin install.

ani27k commented 7 years ago

@amit777 sorry, but it's not true. While developing hybrid application for android, it is required to pass the reversed client I'd.

tobischulz commented 7 years ago

i don´t get it, so i have to change the reversed client-id from console.developers.google.com for Typ=Android while building the android app and have to changed it to the Typ = iOS reversed client-id to build a working iOS app. Is this correct?

JorisDebonnet commented 6 years ago

@rooz121359 seems like hamzahamidi removed their comments (I never saw them). You may want to remove yours too, to avoid confusion.

pldilley commented 6 years ago

Just to clarify, is this the web client ID or the android Client ID that we use for the reverse client ID?

rpbaltazar commented 6 years ago

Although I haven't managed to get it to work, it seems to me that the process for hybrid applications will have a bit of added work as you have to remove the plugin and add it again. At least that is what i understood from #449.

codinronan commented 6 years ago

@pldilley @rpbaltazar you need to use the WEB client ID from your Google console, not the android one. Android doesn't even use it, only iOS does.

As for using with cordova, yes to either change the client ID, or upgrade versions, you need to remove and re-add the plugin. What issues are you guys having? Maybe I can help. I've set this up a number of times now so I've hit most of the major issues..

simoneP93 commented 5 years ago

Hi guys, i am facing the same issue with iOs and i am receiving the 'error invalid_client the oauth client was not found' error. I have a Cordova hybrid application and i installed the googleplus plugin in my app setting the android reverse client id during the installation with node. To get the reverse client id i generated an android app in the google api console following the android installation steps in the documentation

Make sure you execute the keytool steps as explained here or authentication will fail (do this for both release and debug keystores).

IMPORTANT:

The step above, about keytool, show 2 types of certificate fingerprints, the Release and the Debug, when generating the configuration file, it's better to use the Debug certificate fingerprint, after that, you have to go on Google Credentials Manager, and manually create a credential for OAuth2 client with your Release certificate fingerprint. This is necessary to your application work on both Development and Production releases.

Then i tried to set up it for ios and i downloaded the google-services.plist from the firebase account and i noticed that the client id and so also the reverse client id were different from the one with which i installed the plugin. I already tried to change the ios reverse client id in the google-services.plist and set the one from the installation but i still receive the invalid client error. How can i set it up to work for both platforms? Should i create also an ios app on google api console or shoud i use the web client id for both and so reinstall the plugin with that id?

@codinronan maybe you can help me? probably i am just missing something about the configuration.

Thanks in advance.