I am stuck in a very popular issue in the Cordova google-plus plugin. The issue is whenever I include this 'webClientId': '******.apps.googleusercontent.com', I am getting error: 10 and without that webClientId inclusion I am getting data that doesn't provide tokenID but I need tokenID so I am passing client ID generated in Google Developers console as a value to webClientID.
I have seen articles saying that SHA1 might be wrong, so I checked and it turns out that both app-debug.apk SHA-1 and the project in the Google Developers console SHA-1 are the same.
I have followed this article for implementation and I have not included the project in firebase. I know something is wrong with my client ID but I am not able to figure it out. I have tried reinstalling the plugin but it didn't work.
NOTE: If an empty object that is passed as 1st argument to googleplus.login() returns data without any error.
loginGoogle() {
console.log('clicked')
window['plugins'].googleplus.login(
{
'webClientId': '*******.apps.googleusercontent.com',
},
function (obj) {
console.log('data:', obj);
},
function (msg) {
console.log('error: ' + msg);
}
);
}
Google Console has changed its process of getting the CLIENT_ID. We need to create an "OAuth consent screen" and then create
credentialswhere you will get the CLIENT_ID. Now the answer to my question is while creating credentials, as the 1st step, there will be a dropdown for selectingapplication typeand selectwebfor Cordova, Ionic (I am not sure for react-native and native Android) and complete the process.Then you will get a CLIENT_ID aka WEB_CLIENT_ID but if you choose Android in
application typeand the same CLIENT_ID aka ANDRIOD_CLIENT_ID. The problem lies in selectingapplication type. I have answers people are just mentioning WEB_CLIENT_ID.