google / google/GoogleSignIn-iOS

Map alternate scope names in `addScopes`

オープン
#599 コメント 1 件 リアクション 1 件 担当者 1 名 @w-goog が担当を希望しています GitHub で見る
bug
主要言語
Objective-C
スター
750
フォーク
282
平均マージ
2日 15時間
マージ済み PR(30日)
9

説明

**Describe the bug**
When calling `addScopes`, the [check against the existing granted scopes](https://github.com/google/GoogleSignIn-iOS/blob/6ad8c90700ecb28d645c8ff76535732f89c38315/GoogleSignIn/Sources/GIDSignIn.m#L382) doesn't normalize the names. If the [core scopes](https://developers.google.com/identity/protocols/oauth2/scopes#google-sign-in) are passed in using their short names (`email`, `openid`, `profile`), the SDK will prompt unnecessarily, because the granted scopes appear to use [the v2 names](https://developers.google.com/identity/protocols/oauth2/scopes#oauth2).

Obviously this can be easily worked around from the client side by not making that call in the first place, but it creates some unexpected complexity in the Flutter wrapper (see https://github.com/flutter/flutter/issues/184872), which has to bridge across the iOS, Android, and Web sign in APIs (which are all quite different). We can work around it at the wrapper level, but it would be nice if the SDK handled this name mismatch internally.

**To Reproduce**
Steps to reproduce the behavior:
1. Sign in.
2. Call `addScopes:...` with `[@"email", @"openid", @"profile"]` as the scopes.
3. See a user prompt.

**Expected behavior**
Receive `kGIDSignInErrorCodeScopesAlreadyGranted`, since AFAICT signing in grants those scopes automatically, but under different names.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。