Skip to content

Commit b948e3b

Browse files
authored
Remove unification of requested and granted scopes in add scopes flow. (#478)
1 parent ae6faa9 commit b948e3b

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

GoogleSignIn/Sources/GIDSignIn.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,10 @@ - (void)addScopes:(NSArray<NSString *> *)scopes
283283
}
284284
return;
285285
}
286-
287-
// Use the union of granted and requested scopes.
288-
[grantedScopes unionSet:requestedScopes];
289-
options.scopes = [grantedScopes allObjects];
290-
286+
287+
// Previously granted scopes will still be included since we pass `include_granted_scopes=true`.
288+
options.scopes = [requestedScopes allObjects];
289+
291290
[self signInWithOptions:options];
292291
}
293292

GoogleSignIn/Tests/Unit/GIDSignInTest.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,13 @@ - (void)testAddScopes {
764764
[parsedScopes removeObject:@""];
765765
grantedScopes = [parsedScopes copy];
766766
}
767-
767+
768+
#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
769+
NSArray<NSString *> *expectedScopes = @[kNewScope];
770+
#elif TARGET_OS_OSX
768771
NSArray<NSString *> *expectedScopes = @[kNewScope, kGrantedScope];
772+
#endif // TARGET_OS_OSX
773+
769774
XCTAssertEqualObjects(grantedScopes, expectedScopes);
770775

771776
[_user verify];

0 commit comments

Comments
 (0)