Google Consent Screen not appearing, Auth rejected server side (401: Unauthorized_client)

Having an odd problem where the Google Authorization Consent screen is not appearing at all, even though my app is logging in successfully. I have set up the consent screen in my project and all the client IDs and app IDs are correct. I have used Ionic Cloud Auth, ionic-native GooglePlus, and the cordova plugin all with the same results.

This is causing problems because I need to explicitly agree to Offline Access in order to get an access token on the server using an AuthCode that I am sending to it. In the server-side Google Auth docs, they explicitly state: “You can only obtain a refresh token after the user has been presented an authorization dialog requesting offline access.” I suspect that the lack of consent is causing the 401 error on the server.

Any idea why I can even log in and get user details back without getting the consent screen? Any idea where to start looking?

Sample code for making the Auth request:

  var rService = this.rivalsService;
  GooglePlus.login(
    {
      'scopes': 'profile email https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile', 
      'webClientId': '[myClientId]',
      '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
    }).then(
    function (obj) {
      console.log('Google Auth success', JSON.stringify(obj)); // do something useful instead of alerting
      rService.authenticateUser(service, obj.serverAuthCode).then((results) => {
        alert(JSON.stringify(results));
      })
    },
    function (msg) {
      alert('error: ' + msg);
    }
    );

Thanks,
Marc

OK, update – I was able to get the consent screen to show – after going into my Google account and revoking the permission for my app, clearing the data off of the device, and restarting.

However – the Offline Access problem persists. The consent screen only lists “Basic Profile” as a permission, even though my options are set to ‘offline’: true. No idea how to trigger the offline access permission.

Any ideas?

Marc