Просмотр исходного кода

Remove unification of requested and granted scopes in add scopes flow. (#478)

Brianna Morales 1 год назад
Родитель
Сommit
b948e3bb23
2 измененных файлов с 10 добавлено и 6 удалено
  1. 4 5
      GoogleSignIn/Sources/GIDSignIn.m
  2. 6 1
      GoogleSignIn/Tests/Unit/GIDSignInTest.m

+ 4 - 5
GoogleSignIn/Sources/GIDSignIn.m

@@ -283,11 +283,10 @@ static NSString *const kClientAssertionTypeParameterValue =
     }
     return;
   }
-
-  // Use the union of granted and requested scopes.
-  [grantedScopes unionSet:requestedScopes];
-  options.scopes = [grantedScopes allObjects];
-
+  
+  // Previously granted scopes will still be included since we pass `include_granted_scopes=true`.
+  options.scopes = [requestedScopes allObjects];
+  
   [self signInWithOptions:options];
 }
 

+ 6 - 1
GoogleSignIn/Tests/Unit/GIDSignInTest.m

@@ -764,8 +764,13 @@ static NSString *const kNewScope = @"newScope";
     [parsedScopes removeObject:@""];
     grantedScopes = [parsedScopes copy];
   }
-  
+
+#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
+  NSArray<NSString *> *expectedScopes = @[kNewScope];
+#elif TARGET_OS_OSX
   NSArray<NSString *> *expectedScopes = @[kNewScope, kGrantedScope];
+#endif // TARGET_OS_OSX
+
   XCTAssertEqualObjects(grantedScopes, expectedScopes);
 
   [_user verify];