Ionic 2 + Ionic Cloud Auth: Google Auth failing (12501)

So…

I’ve been banging my head against the wall for a day or so trying to get the Google Auth to work with Ionic Cloud. So far I have successfully set up my Ionic Cloud account, and successfully added a user with Ionic Auth.

I have followed all the instructions in the Cloud docs to add Google Auth (native), including setting up the project in Google Developer Console. I used the keytool to get the debug certificate from the .android directory, and I have used that in my Google project. I grabbed the webClientId from my webservice Oauth credential and am passing that in to the app.module, all according to the docs.

I am using:

“ionic run android --debug” to deploy to the device. I get the following:


(Note that the weird blank button at the bottom is my google login trigger.)

I am able to select which account, but then it fails with an Unhandled Promise Exception: 12501. I dug around and it seems that this is the code for “User Cancelled”. Seems there were some problems with this in earlier Googleplus plugin development, but all the issues were in Ionic 1 and didn’t use Ionic Cloud, so I wasn’t able to figure out a possible solution. But there is a suggestion that if the package isn’t signed properly, it may return this error.

So a few questions:

  1. Is using the --debug flag adequate to sign the debug apk properly when using ionic run? If not, how do I run a properly signed apk?
  2. I have a keystore that I pulled in from an old project. It’s just sitting in my bitbucket folder, and keytool seems to recognize it. Is it possible that ionic is signing with a different keystore? It’s not asking for authentication of my keystore.
  3. Should the GoogleAuth be working in Ionic Serve? That’s not working either. I get no response at all from Google.

Sorry, i’m pretty much a n00b with this stuff. The docs kind of leave off when the going gets tough – like how to get it to actually work. There seem to be a few steps missing to ensure that everything is signed properly. Any help appreciated.

Thanks,
Marc

Some add’l info:

From my app.module.ts:

import { CloudSettings, CloudModule } from '@ionic/cloud-angular';

const cloudSettings: CloudSettings = {
  'core': {
    'app_id': '[MY_APP_ID]'   // found in ionic.config.json and in the cloud dashboard
  },
  'auth': {
    'google': {
      'webClientId': '[THEWEBCLIENTIDFROMCONSOLE].apps.googleusercontent.com',
      'scope': ['permission1', 'permission2']
    }
  }
};

Ionic info:

ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3-201611211919
Ionic CLI Version: 2.1.14
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.44
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.2
Xcode version: Not installed

Ionic plugins:

cordova-plugin-console 1.0.4 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-googleplus 5.1.1 "Google SignIn"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-splashscreen 4.0.2-dev "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
cordova-plugin-wkwebview-engine 1.1.1-dev "Cordova WKWebView Engine"
ionic-plugin-keyboard 2.2.1 “Keyboard”

Thanks,
Marc

Hi,

Follow the steps given here.

Thanks for the link. It was good to go through and double check everything and see that you can indeed simply use Ionic run (without separately signing the APK).

All of my setup was correct. However, I made two changes:

  1. I removed the values from the permission array (though the Ionic Docs do not instruct to do this)
  2. I deleted my keystore file from my root bitbucket directory.

I have no idea what did it, but it is now WORKING. Hopefully this helps someone else.

Thanks,
Marc

FYI – googleAuth still does not work in Ionic Serve – is that normal? I understand that the native plugin (Cordova) is not available, but I assumed there would be some kind of polyfill that used the web client auth…

Marc

1 Like

Thanks removing the values solved my problem!

I deleted my keystore file from my root bitbucket directory? please explain

i resolved this issue by making sure sha1 key is same as the one i have in google console. This problem usually goes away when sha1 keys are same , i.e. the keystore you are using and the one registered with google console. hope this helps