EddyVerbruggen / cordova-plugin-googleplus

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

Using cordova-plugin-googleplus fails with error msg 8 after including google game services scope #409

Open adampru209 opened 7 years ago

adampru209 commented 7 years ago

I have been able to successfully implement and test EddyVerbuggen's cordova-plugin-googleplus with the auth/drive.appdata scope on an android device, but I am no longer able to log in after adding the auth/games and auth/plus.login scopes. Both of these scopes are turned on in my Google API Console Project. I have set up games service in my Google Play Developer Console and have made sure that the active Client ID has my debug.keystore SHA1 signature. Any ideas on what I am doing wrong?

Here's the code I'm using which is resulting in error message 8.

var SCOPES='https://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/games https://www.googleapis.com/auth/plus.login';
function OAuthLogin()
{
  window.plugins.googleplus.login(
    {
      'scopes': SCOPES, // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
      'webClientId': CLIENT_ID, // 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) {
      OAuthSuccess(obj);
    },
    function (msg) {
      console.log(msg);
      alert('error: ' + msg);
    }
  );
}
iconico commented 7 years ago

Looks like your SCOPES variable is formatted incorrectly.

The default scopes requested are profile and email (always requested). To request other scopes, add them as a space-separated list to the scopes parameter. They will be requested exactly as passed in. Refer to the Google Scopes documentation for info on valid scopes that can be requested. For example, 'scope': 'https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/tasks'.