7474// The name of the query parameter used for logging the restart of auth from EMM callback.
7575static NSString *const kEMMRestartAuthParameter = @" emmres" ;
7676
77- // The URL template for the authorization endpoint.
78- static NSString *const kAuthorizationURLTemplate = @" https://%@ /o/oauth2/v2/auth" ;
79-
80- // The URL template for the token endpoint.
81- static NSString *const kTokenURLTemplate = @" https://%@ /token" ;
82-
8377// The URL template for the URL to get user info.
8478static NSString *const kUserInfoURLTemplate = @" https://%@ /oauth2/v3/userinfo" ;
8579
@@ -161,8 +155,7 @@ @implementation GIDSignIn {
161155 // set when a sign-in flow is begun via |signInWithOptions:| when the options passed don't
162156 // represent a sign in continuation.
163157 GIDSignInInternalOptions *_currentOptions;
164- // AppAuth configuration object.
165- OIDServiceConfiguration *_appAuthConfiguration;
158+
166159 // AppAuth external user-agent session state.
167160 id <OIDExternalUserAgentSession> _currentAuthorizationFlow;
168161 // Flag to indicate that the auth flow is restarting.
@@ -467,7 +460,7 @@ - (id)initPrivate {
467460}
468461
469462- (instancetype )initWithKeychainHandler : (id <GIDKeychainHandler>)keychainHandler
470- httpFetcher : (id <GIDHTTPFetcher>)httpFetcher {
463+ httpFetcher : (id <GIDHTTPFetcher>)httpFetcher {
471464 self = [super init ];
472465 if (self) {
473466 // Get the bundle of the current executable.
@@ -486,17 +479,10 @@ - (instancetype)initWithKeychainHandler:(id<GIDKeychainHandler>)keychainHandler
486479 [_keychainHandler removeAllKeychainEntries ];
487480 }
488481
489- NSString *authorizationEnpointURL = [NSString stringWithFormat: kAuthorizationURLTemplate ,
490- [GIDSignInPreferences googleAuthorizationServer ]];
491- NSString *tokenEndpointURL = [NSString stringWithFormat: kTokenURLTemplate ,
492- [GIDSignInPreferences googleTokenServer ]];
493- _appAuthConfiguration = [[OIDServiceConfiguration alloc ]
494- initWithAuthorizationEndpoint: [NSURL URLWithString: authorizationEnpointURL]
495- tokenEndpoint: [NSURL URLWithString: tokenEndpointURL]];
496-
497482#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
498483 // Perform migration of auth state from old (before 5.0) versions of the SDK if needed.
499- [GIDAuthStateMigration migrateIfNeededWithTokenURL: _appAuthConfiguration.tokenEndpoint
484+ NSURL *tokenEndpointURL = [GIDSignInPreferences tokenEndpointURL ];
485+ [GIDAuthStateMigration migrateIfNeededWithTokenURL: tokenEndpointURL
500486 callbackPath: kBrowserCallbackPath
501487 keychainName: kGTMAppAuthKeychainName
502488 isFreshInstall: isFreshInstall];
@@ -602,9 +588,15 @@ - (void)authenticateInteractivelyWithOptions:(GIDSignInInternalOptions *)options
602588#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
603589 additionalParameters[kSDKVersionLoggingParameter ] = GIDVersion ();
604590 additionalParameters[kEnvironmentLoggingParameter ] = GIDEnvironment ();
591+
592+ NSURL *authorizationEndpointURL = [GIDSignInPreferences authorizationEndpointURL ];
593+ NSURL *tokenEndpointURL = [GIDSignInPreferences tokenEndpointURL ];
594+ OIDServiceConfiguration *appAuthConfiguration =
595+ [[OIDServiceConfiguration alloc ] initWithAuthorizationEndpoint: authorizationEndpointURL
596+ tokenEndpoint: tokenEndpointURL];
605597
606598 OIDAuthorizationRequest *request =
607- [[OIDAuthorizationRequest alloc ] initWithConfiguration: _appAuthConfiguration
599+ [[OIDAuthorizationRequest alloc ] initWithConfiguration: appAuthConfiguration
608600 clientId: options.configuration.clientID
609601 scopes: options.scopes
610602 redirectURL: redirectURL
0 commit comments