google / google/GoogleSignIn-iOS
Allow only requesting the oauth scopes that an app needs
- Dominant language
- Objective-C
- Stars
- 750
- Forks
- 282
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 9
Description
**Is your feature request related to a problem you're having? Please describe.**
My app needs to write new files to Google Drive, and it needs nothing else. As such, the only scope I request is `https://www.googleapis.com/auth/drive.file`. However, the login screen suggests that the app will be much more invasive than it is:

It appears that additional scopes beyond what the consuming app requests are always requested:
https://github.com/google/GoogleSignIn-iOS/blob/main/GoogleSignIn/Sources/GIDSignInInternalOptions.m#L56
https://github.com/google/GoogleSignIn-iOS/blob/main/GoogleSignIn/Sources/GIDScopes.m#L58
Specifically it looks like the email and profile scopes are always added.
My assumption is that those additional scopes are unnecessary for basic usage, but please tell me if I am incorrect.
As an additional downside, requesting extraneous scopes makes implementing [Google's new granular permissions](https://developers.google.com/identity/protocols/oauth2/resources/granular-permissions) more messy and complicated.
**Describe the solution you'd like**
In the spirit of the principle of least privilege, it should be possible to use Google SignIn without extraneous scopes added. To do this in a backwards compatible way, the current behavior should remain the default, but it should be possible to set a flag to avoid scopes being added.
This seems like a very small change.
**Describe alternatives you've considered**
First, it's possible that those other scopes are necessary for all Google API usage. However, the fact that granular permissions allows rejecting them, that seems false.
Second, it's possible that consumers of Google SignIn just live with requesting extra scopes. However, that makes their apps look more invasive than they need, and thus sketchy. Further, it means that developers need to unnecessarily handle the more complicated granular permission case where you request many scopes.
**Additional context**
I'm happy to contribute this feature if it would be accepted.
Contributor guide
Assessment
This issue has not been assessed yet.