I am working on a hybrid mobile app using Ionic and Parse Server as a back-end and for the past three days I’ve been trying to implement Google login with the native Google Plus plugin. It was a rough ride!
Error 10
“The application is misconfigured. This error is not recoverable and will be treated as fatal. The developer should look at the logs after this to determine more actionable information.” –Google Common API Documentation
If you are facing error 10 with the native Google Plus plugin you should check your certificate’s configuration and make sure your APK is signed. In my case I was using Ionic cloud service to build my project, for some strange reason the downloaded APK from Ionic wasn’t signed. I had to build and sign my project locally using `ionic cordova build android`
command, I was still having the same problem (Unable to sign the APK)! Then I had to change keystore password to a new one, the old password had special characters and I am not quite sure if this was the problem.
Parse Server
After I get rid of error 10 I needed to enable social login using Google in Parse Server. However, The documentation is really lacking in the regard, they show you how to login using Facebook and Twitter but no instructions whatsoever about Google. Although Google login is enabled by default in Parse.
In Ionic and after you get the payload from Google Plus plugin you will need to create a new object with the following format:
let authData;
this.googlePlus.login({}).then( res => {
authData = { authData:{id: res.userId, access_token:res.accessToken,id_token: res.idToken}};
let user = new this.Parse.User();
return user._linkWith('google', authData);
});
Then in the back-end Parse Server should be able to pass authData to Google API to make sure they are valid.