7

Hi Stackoverflow community,

I'm trying to configure a web app to make use of certain Google scopes. I want the user to either approve all of them or reject all of them.

This is exactly the behavior I do get when playing around with Google OAuth Playground:

Google OAuth Playground

See, I get per each scope a "solid circle" that can not be unchecked. The user either allows access to all listed scopes or denies access to all of them. All at once.

But in my app, each permission is mapped to a popup that can be ALLOWED or DENIED. Plus, at the end, the same consent screen is displayed but with the ability for the user to select/unselect certain permissions. (checkboxes)

Scope 1 Scope 2 Consent Screen

Even though this might sound like more granular I think this is also a little more confusing, plus it extends the logic in my app as I need to double check that permissions to all scopes have been granted. I do need both of them for doing what I need to do, so, only one scope is not useful to me, I might need to re-trigger the grant permission process: which is actually what I'm trying to avoid. I mean, it's OK to deal with the complete denied scenario, but having partial scopes approved is not something I do want to have.

The solution would be to emulate what Google OAuth Playground does.

I've added the scopes explicitly in my consent screen config (which nows figures as under review). But still I do get this behavior.

Which config or param to the oAuth url I might be missing to get that exact behavior?

Thanks!

cSn
  • 2,796
  • 3
  • 23
  • 29

1 Answers1

2

Turns out that, after adding the specific scopes I needed in:

https://console.cloud.google.com/apis/credentials/consent/edit?project={YourProjectID}

enter image description here

After a while... I started to see the consent screen with solid circles instead of optional checkboxes!

cSn
  • 2,796
  • 3
  • 23
  • 29
  • Hey, I've added the scopes I use (only `drive.appdata` which is not sensitive or restricted) and verified my app as well. However, I still keep seeing a checkmark for the permission(the checkmark is even unchecked initially). Do you have any idea why that might be the case? – Max Sep 22 '21 at 16:59
  • @Max Same thing is happening to me. Did you find a solution? – jmart Oct 02 '21 at 17:06
  • 1
    @jmart check out https://stackoverflow.com/questions/64573910/disable-checkboxes-on-google-consent-screen/65128371#65128371 – Max Oct 02 '21 at 18:40
  • 1
    Instead of requesting the permissions during login, I do a normal login and request the permissions afterward with `GoogleSignIn.requestPermissions()`. You will also need to check if your app has the needed permissions before using them, which you can do with `GoogleSignIn.hasPermissions()` – Max Oct 02 '21 at 18:42
  • 2
    @cSn Late comment, but thank you for the solution: In the OAuth consent screen, I added ". /auth/drive", but I forgot to add "email", "profile", and "openid" because I thought they were basic permissions. After adding them, the checkboxes no longer appear. – Inclu Cat Jan 21 '22 at 05:37