f-23 / react-native-passkey

Passkeys for React Native
MIT License
135 stars 31 forks source link

Local development: how to set up on simulator? #10

Closed bryanlatten closed 1 year ago

bryanlatten commented 1 year ago

Thanks for the great library. There is a lot going on here, trying to understand all the pieces that are necessary!

Desperately trying to integrate this locally (on iOS simulator), and keep running into the same issue: "An unknown error occurred". Despite this, if I create a release build I am able to use the library.

Mac Console has some interesting messages from the simulator:

ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "(null)" Could not perform authorization: Error Domain=com.apple.AuthenticationServicesCore.AuthorizationError Code=1 "(null)" Device not configured for passkey requests: Error Domain=com.apple.LocalAuthentication Code=-7 "(null)"

f-23 commented 1 year ago

Hi there! Just to clarify: The release build is working in the simulator, but the debug build is not? What iOS Version are you running on the simulator?

I'm not able to reproduce this on a simulator running iOS 16.4, so a couple more details would be appreciated. Error code 1004 usually indicates a domain issue for me so I would also recommend double checking your associated domain configuration (Try removing the ?mode=developer, should work fine without).

bryanlatten commented 1 year ago

Thanks for the response and apologies yes, let me clarify.

Simulator has not worked in any configuration with-or-without mode=developer, with-or-without associated domain config. I have tried running localhost/.well-known/apple-site-association on http/https, various ports as well.

Release build on real devices works. Being able to try development against only "real" builds is just a painfully slower experience, as you might imagine. Would love to get a simulator flow working!

If you saying that you're able to successfully trigger passkey workflow on the simulator, would love to know any and all configuration that you set up. Xcode version? iCloud signed in or out? FaceID enrolled or not? Any additional configuration flags thrown on launch. Any help is appreciated!

f-23 commented 1 year ago

Sure thing. I'm running Xcode 14.3, Simulator is on 16.4 as mentioned above. FaceID/TouchID is enrolled (AFAIK it has to be enrolled for passkeys to work anyways), not signed in to iCloud. Also not using any additional flags, just the debug build scheme.

You've mentioned running the associated domain endpoint on localhost. In my tests this was causing a lot of problems, which is why I switched to ngrok, might want to give it a shot and see if that helps.

Are you trying to run the example app from this repo or your own implementation?

bryanlatten commented 1 year ago

@f-23 solid suggestion.

Went back to basics, looks like my debug and release builds differed in team ID, which stopped it cold. Thanks again!