Selaa lähdekoodia

Revert "Dry up auth flow. (#208)"

This reverts commit 04d8fdf8aaee94ee49fb40e3b0103f535cb1803e.
Peter Andrews 3 vuotta sitten
vanhempi
sitoutus
47b0a732d6
1 muutettua tiedostoa jossa 22 lisäystä ja 4 poistoa
  1. 22 4
      GoogleSignIn/Sources/GIDSignIn.m

+ 22 - 4
GoogleSignIn/Sources/GIDSignIn.m

@@ -589,6 +589,7 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
   additionalParameters[kSDKVersionLoggingParameter] = GIDVersion();
   additionalParameters[kEnvironmentLoggingParameter] = GIDEnvironment();
 
+#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
   OIDAuthorizationRequest *request =
       [[OIDAuthorizationRequest alloc] initWithConfiguration:_appAuthConfiguration
                                                     clientId:options.configuration.clientID
@@ -599,17 +600,34 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
 
   _currentAuthorizationFlow = [OIDAuthorizationService
       presentAuthorizationRequest:request
-#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
          presentingViewController:options.presentingViewController
-#elif TARGET_OS_OSX
-                 presentingWindow:options.presentingWindow
-#endif // TARGET_OS_OSX
                         callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse,
                                    NSError *_Nullable error) {
     [self processAuthorizationResponse:authorizationResponse
                                  error:error
                             emmSupport:emmSupport];
   }];
+#elif TARGET_OS_OSX
+  OIDAuthorizationRequest *request =
+      [[OIDAuthorizationRequest alloc] initWithConfiguration:_appAuthConfiguration
+                                                    clientId:options.configuration.clientID
+                                                clientSecret:@""
+                                                      scopes:options.scopes
+                                                 redirectURL:redirectURL
+                                                responseType:OIDResponseTypeCode
+                                        additionalParameters:additionalParameters];
+
+  _currentAuthorizationFlow = [OIDAuthorizationService
+      presentAuthorizationRequest:request
+                 presentingWindow:options.presentingWindow
+                         callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse,
+                                    NSError *_Nullable error) {
+    [self processAuthorizationResponse:authorizationResponse
+                                 error:error
+                            emmSupport:emmSupport];
+  }];
+#endif // TARGET_OS_OSX
+
 }
 
 - (void)processAuthorizationResponse:(OIDAuthorizationResponse *)authorizationResponse