|
|
@@ -234,12 +234,25 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
hint:(nullable NSString *)hint
|
|
|
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
|
completion:(nullable GIDSignInCompletion)completion {
|
|
|
+ [self signInWithPresentingViewController:presentingViewController
|
|
|
+ hint:hint
|
|
|
+ additionalScopes:additionalScopes
|
|
|
+ nonce:nil
|
|
|
+ completion:completion];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)signInWithPresentingViewController:(UIViewController *)presentingViewController
|
|
|
+ hint:(nullable NSString *)hint
|
|
|
+ additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
|
+ nonce:(nullable NSString *)nonce
|
|
|
+ completion:(nullable GIDSignInCompletion)completion {
|
|
|
GIDSignInInternalOptions *options =
|
|
|
[GIDSignInInternalOptions defaultOptionsWithConfiguration:_configuration
|
|
|
presentingViewController:presentingViewController
|
|
|
loginHint:hint
|
|
|
addScopesFlow:NO
|
|
|
scopes:additionalScopes
|
|
|
+ nonce:nonce
|
|
|
completion:completion];
|
|
|
[self signInWithOptions:options];
|
|
|
}
|
|
|
@@ -315,12 +328,25 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
hint:(nullable NSString *)hint
|
|
|
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
|
completion:(nullable GIDSignInCompletion)completion {
|
|
|
+ [self signInWithPresentingWindow:presentingWindow
|
|
|
+ hint:hint
|
|
|
+ additionalScopes:additionalScopes
|
|
|
+ nonce:nil
|
|
|
+ completion:completion];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)signInWithPresentingWindow:(NSWindow *)presentingWindow
|
|
|
+ hint:(nullable NSString *)hint
|
|
|
+ additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
|
+ nonce:(nullable NSString *)nonce
|
|
|
+ completion:(nullable GIDSignInCompletion)completion {
|
|
|
GIDSignInInternalOptions *options =
|
|
|
[GIDSignInInternalOptions defaultOptionsWithConfiguration:_configuration
|
|
|
presentingWindow:presentingWindow
|
|
|
loginHint:hint
|
|
|
addScopesFlow:NO
|
|
|
scopes:additionalScopes
|
|
|
+ nonce:nonce
|
|
|
completion:completion];
|
|
|
[self signInWithOptions:options];
|
|
|
}
|
|
|
@@ -539,7 +565,7 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
if (!_configuration) {
|
|
|
// NOLINTNEXTLINE(google-objc-avoid-throwing-exception)
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
- format:@"No active configuration. Make sure GIDClientID is set in Info.plist."];
|
|
|
+ format:@"No active configuration. Make sure GIDClientID is set in Info.plist."];
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -633,7 +659,6 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
[_timedLoader startTiming];
|
|
|
[self->_appCheck getLimitedUseTokenWithCompletion:^(GACAppCheckToken * _Nullable token,
|
|
|
NSError * _Nullable error) {
|
|
|
- OIDAuthorizationRequest *request = nil;
|
|
|
if (token) {
|
|
|
additionalParameters[kClientAssertionTypeParameter] = kClientAssertionTypeParameterValue;
|
|
|
additionalParameters[kClientAssertionParameter] = token.token;
|
|
|
@@ -643,7 +668,7 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
NSLog(@"[Google Sign-In iOS]: Error retrieving App Check limited use token: %@", error);
|
|
|
}
|
|
|
#endif
|
|
|
- request = [self authorizationRequestWithOptions:options
|
|
|
+ OIDAuthorizationRequest *request = [self authorizationRequestWithOptions:options
|
|
|
additionalParameters:additionalParameters];
|
|
|
if (self->_timedLoader.animationStatus == GIDTimedLoaderAnimationStatusAnimating) {
|
|
|
[self->_timedLoader stopTimingWithCompletion:^{
|
|
|
@@ -667,13 +692,23 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
- (OIDAuthorizationRequest *)
|
|
|
authorizationRequestWithOptions:(GIDSignInInternalOptions *)options
|
|
|
additionalParameters:(NSDictionary<NSString *, NSString *> *)additionalParameters {
|
|
|
- OIDAuthorizationRequest *request =
|
|
|
- [[OIDAuthorizationRequest alloc] initWithConfiguration:_appAuthConfiguration
|
|
|
- clientId:options.configuration.clientID
|
|
|
- scopes:options.scopes
|
|
|
- redirectURL:[self redirectURLWithOptions:options]
|
|
|
- responseType:OIDResponseTypeCode
|
|
|
- additionalParameters:additionalParameters];
|
|
|
+ OIDAuthorizationRequest *request;
|
|
|
+ if (options.nonce) {
|
|
|
+ request = [[OIDAuthorizationRequest alloc] initWithConfiguration:_appAuthConfiguration
|
|
|
+ clientId:options.configuration.clientID
|
|
|
+ scopes:options.scopes
|
|
|
+ redirectURL:[self redirectURLWithOptions:options]
|
|
|
+ responseType:OIDResponseTypeCode
|
|
|
+ nonce:options.nonce
|
|
|
+ additionalParameters:additionalParameters];
|
|
|
+ } else {
|
|
|
+ request = [[OIDAuthorizationRequest alloc] initWithConfiguration:_appAuthConfiguration
|
|
|
+ clientId:options.configuration.clientID
|
|
|
+ scopes:options.scopes
|
|
|
+ redirectURL:[self redirectURLWithOptions:options]
|
|
|
+ responseType:OIDResponseTypeCode
|
|
|
+ additionalParameters:additionalParameters];
|
|
|
+ }
|
|
|
return request;
|
|
|
}
|
|
|
|
|
|
@@ -724,7 +759,7 @@ static NSString *const kClientAssertionTypeParameterValue =
|
|
|
|
|
|
- (void)processAuthorizationResponse:(nullable OIDAuthorizationResponse *)authorizationResponse
|
|
|
error:(nullable NSError *)error
|
|
|
- emmSupport:(NSString *)emmSupport{
|
|
|
+ emmSupport:(NSString *)emmSupport {
|
|
|
if (_restarting) {
|
|
|
// The auth flow is restarting, so the work here would be performed in the next round.
|
|
|
_restarting = NO;
|