@@ -409,26 +409,30 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
409
409
}
410
410
}
411
411
} else {
412
+ OIDAuthStateAuthorizationCallback callback = ^(
413
+ OIDAuthState *_Nullable authState,
414
+ NSError *_Nullable error
415
+ ) {
416
+ typeof (self) strongSelf = weakSelf;
417
+ strongSelf->_currentSession = nil ;
418
+ [UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
419
+ rnAppAuthTaskId = UIBackgroundTaskInvalid;
420
+ if (authState) {
421
+ resolve ([self formatResponse: authState.lastTokenResponse
422
+ withAuthResponse: authState.lastAuthorizationResponse]);
423
+ } else {
424
+ reject ([self getErrorCode: error defaultCode: @" authentication_failed" ],
425
+ [self getErrorMessage: error], error);
426
+ }
427
+ };
412
428
413
429
if (externalUserAgent != nil ) {
414
- _currentSession = [OIDAuthorizationService presentAuthorizationRequest : request
430
+ _currentSession = [OIDAuthState authStateByPresentingAuthorizationRequest : request
415
431
externalUserAgent: externalUserAgent
416
432
callback: callback];
417
433
} else {
418
- OIDAuthStateAuthorizationCallback callback = ^(OIDAuthState *_Nullable authState,
419
- NSError *_Nullable error) {
420
- typeof (self) strongSelf = weakSelf;
421
- strongSelf->_currentSession = nil ;
422
- [UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
423
- rnAppAuthTaskId = UIBackgroundTaskInvalid;
424
- if (authState) {
425
- resolve ([self formatResponse: authState.lastTokenResponse
426
- withAuthResponse: authState.lastAuthorizationResponse]);
427
- } else {
428
- reject ([self getErrorCode: error defaultCode: @" authentication_failed" ],
429
- [self getErrorMessage: error], error);
430
- }
431
- };
434
+
435
+
432
436
if (@available (iOS 13 , *)) {
433
437
_currentSession = [OIDAuthState authStateByPresentingAuthorizationRequest: request
434
438
presentingViewController: presentingViewController
0 commit comments