google / google/GoogleSignIn-iOS

Allow only requesting the oauth scopes that an app needs

未关闭
#440 4 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Objective-C
星标
750
派生
282
平均合并
2 天 15 小时
30 天内合并 PR
9

描述

**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:
![image](https://github.com/google/GoogleSignIn-iOS/assets/4286394/7d3bcb39-d315-4f8a-b1a6-15222f58c903)

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。