Skip to content

[iOS] RN 0.74 NewArch + bridgelesssMode ON authorize, refresh, logout doesn't work, Promise Rejection #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
artur-burlak opened this issue May 26, 2024 · 5 comments
Labels
issue-accepted This issue has been confirmed and accepted by the maintainers

Comments

@artur-burlak
Copy link

artur-burlak commented May 26, 2024

Issue

On iOS 17.4 RN 0.74.1 NewArch + bridgelessMode ON(THIS IS IMPORTANT) authorize, refresh, logout are throwing promise rejection.

Possible unhandled promise rejection: RNAppAuth.authorize(): Error while converting JavaScript argument 10 to objectiove C type BOOL. Objective C type BOOL is unsupported.

Screenshot 2024-05-26 at 20 19 33
Screenshot 2024-05-26 at 20 20 03

Here useNonce = true by default

ATTENTION: This happening only on bridgelessMode ON. Looks like some turbo modules issue.


Environment

  • Your Identity Provider: Azure
  • Platform that you're experiencing the issue on: iOS
  • Your react-native Version: e.g. 0.74.1
  • Your react-native-app-auth Version: e.g. 7.1.3
  • Are you using Expo? NO
@carbonrobot carbonrobot added the issue-accepted This issue has been confirmed and accepted by the maintainers label Jun 3, 2024
@carbonrobot
Copy link
Contributor

We are actively working on Bridgeless support and hope to have an update soon.

@steve4835
Copy link

I am having this issue as well

@Johennes
Copy link

If anyone else is facing this, I used patch-package with

diff --git a/node_modules/react-native-app-auth/ios/RNAppAuth.m b/node_modules/react-native-app-auth/ios/RNAppAuth.m
index eb11aa5..938c045 100644
--- a/node_modules/react-native-app-auth/ios/RNAppAuth.m
+++ b/node_modules/react-native-app-auth/ios/RNAppAuth.m
@@ -97,10 +97,10 @@ - (dispatch_queue_t)methodQueue
                  skipCodeExchange: (BOOL) skipCodeExchange
                  connectionTimeoutSeconds: (double) connectionTimeoutSeconds
                  additionalHeaders: (NSDictionary *_Nullable) additionalHeaders
-                 useNonce: (BOOL *) useNonce
-                 usePKCE: (BOOL *) usePKCE
+                 useNonce: (BOOL) useNonce
+                 usePKCE: (BOOL) usePKCE
                  iosCustomBrowser: (NSString *) iosCustomBrowser
-                 prefersEphemeralSession: (BOOL *) prefersEphemeralSession
+                 prefersEphemeralSession: (BOOL) prefersEphemeralSession
                  resolve: (RCTPromiseResolveBlock) resolve
                  reject: (RCTPromiseRejectBlock)  reject)
 {
@@ -204,7 +204,7 @@ - (dispatch_queue_t)methodQueue
                  serviceConfiguration: (NSDictionary *_Nullable) serviceConfiguration
                  additionalParameters: (NSDictionary *_Nullable) additionalParameters
                  iosCustomBrowser: (NSString *) iosCustomBrowser
-                 prefersEphemeralSession: (BOOL *) prefersEphemeralSession
+                 prefersEphemeralSession: (BOOL) prefersEphemeralSession
                  resolve:(RCTPromiseResolveBlock) resolve
                  reject: (RCTPromiseRejectBlock)  reject)
 {
@@ -325,12 +325,12 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
                           clientId: (NSString *) clientId
                       clientSecret: (NSString *) clientSecret
                             scopes: (NSArray *) scopes
-                          useNonce: (BOOL *) useNonce
-                           usePKCE: (BOOL *) usePKCE
+                          useNonce: (BOOL) useNonce
+                           usePKCE: (BOOL) usePKCE
               additionalParameters: (NSDictionary *_Nullable) additionalParameters
               skipCodeExchange: (BOOL) skipCodeExchange
                   iosCustomBrowser: (NSString *) iosCustomBrowser
-           prefersEphemeralSession: (BOOL *) prefersEphemeralSession
+           prefersEphemeralSession: (BOOL) prefersEphemeralSession
                            resolve: (RCTPromiseResolveBlock) resolve
                             reject: (RCTPromiseRejectBlock)  reject
 {
@@ -489,7 +489,7 @@ - (void)endSessionWithConfiguration: (OIDServiceConfiguration *) configuration
               postLogoutRedirectURL: (NSString *) postLogoutRedirectURL
                additionalParameters: (NSDictionary *_Nullable) additionalParameters
                    iosCustomBrowser: (NSString *) iosCustomBrowser
-            prefersEphemeralSession: (BOOL *) prefersEphemeralSession
+            prefersEphemeralSession: (BOOL) prefersEphemeralSession
                             resolve: (RCTPromiseResolveBlock) resolve
                              reject: (RCTPromiseRejectBlock) reject {
 
@@ -734,7 +734,7 @@ - (NSString*)getErrorMessage: (NSError*) error {
 }
 
 - (id<OIDExternalUserAgent>)getExternalUserAgentWithPresentingViewController: (UIViewController *)presentingViewController
-                                                     prefersEphemeralSession: (BOOL *) prefersEphemeralSession
+                                                     prefersEphemeralSession: (BOOL) prefersEphemeralSession
 {
   id<OIDExternalUserAgent> externalUserAgent;
   #if TARGET_OS_MACCATALYST

and it appears to work fine for my use case.

@artur-burlak
Copy link
Author

artur-burlak commented Jul 11, 2024

If anyone else is facing this, I used patch-package with

Thank you, I would wait for official update, if it will not take too long

@carbonrobot
Copy link
Contributor

Released in v8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-accepted This issue has been confirmed and accepted by the maintainers
Projects
None yet
Development

No branches or pull requests

4 participants