Skip to content

[BUG] signUpWithApple is not passing params to ASAuthorizationAppleIDRequest #24

Closed

Description

@elivinsky

Describe the bug

signUpWithApple is not passing params to ASAuthorizationAppleIDRequest. According to docs, it can receive nonce and requestedScopes but they are ignored in the native side of the library.

Steps to Reproduce

  1. Call signUpWithApple with a nonce string
  2. Receive an idToken without such nonce

Expected behavior

idToken should include the nonce in the params to validate it server-side.

Actual behavior

idToken does not contain a nonce in the JWT

Code snippet

https://github.com/benjamineruvieru/react-native-credentials-manager/blob/main/ios/CredentialsManager.mm#L217

- (void)signUpWithApple:(JS::NativeCredentialsManager::AppleSignInParams &)params
                resolve:(RCTPromiseResolveBlock)resolve
                 reject:(RCTPromiseRejectBlock)reject {
    
    dispatch_async(dispatch_get_main_queue(), ^{
        self.currentResolve = resolve;
        self.currentReject = reject;
        
        ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init];
        ASAuthorizationAppleIDRequest *appleIDRequest = [appleIDProvider createRequest];
        
        appleIDRequest.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
        
        ASAuthorizationController *authController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[appleIDRequest]];
        authController.delegate = self;
        authController.presentationContextProvider = self;
        
        [authController performRequests];
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions