Skip to content
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

ERROR Error during passkey creation {"error": "Native error", "message": "androidx.credentials.exceptions.domerrors.SecurityError@7337b1"}. #6

Open
vikasvk3510 opened this issue Oct 25, 2024 · 15 comments

Comments

@vikasvk3510
Copy link

ERROR Error during passkey creation {"error": "Native error", "message": "androidx.credentials.exceptions.domerrors.SecurityError@7337b1"}. WHY THIS HAPPENS

@r-n-o
Copy link
Collaborator

r-n-o commented Oct 25, 2024

@vikasvk3510 unsure why this is happening at first glance, but "SecurityError" hints at some kind of policy being violated. Maybe because the RPID isn't compatible with the domain? You need to host a /.well-known/assetlinks.json at the root of your domain for passkey creation to work correctly.

@vikasvk3510
Copy link
Author

vikasvk3510 commented Oct 29, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Oct 29, 2024

If you're comfortable doing so, can you share your domain and a link to your repo? Unfortunately my experience with native passkey implementation is that it's quite finicky and hard to debug. Just to name a few things I ran into: the app being signed with the wrong debug cert, app run in a context which doesn't allow passkeys, app domain and RPID mismatch because of typos or subdomains, wrong Content-Type headers on files hosted at /.well-known/..., hosted files being cached by Apple/Google's infrastructure.

Enabling device-side debug logs might help. As-is it's difficult for me to really dig in without more information.

@vikasvk3510
Copy link
Author

vikasvk3510 commented Oct 30, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Oct 30, 2024

@vikasvk3510 shot in the dark: could it be the same issue than what I've encountered in f-23/react-native-passkey#29 (comment)? What is the value of userId in your code? Android requires that it's a valid base64-encoded string.

@vikasvk3510
Copy link
Author

vikasvk3510 commented Nov 4, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Nov 4, 2024

Ok cool. So that's not it then. Looks like perfectly valid base64 to me!

@vikasvk3510
Copy link
Author

vikasvk3510 commented Nov 5, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Nov 5, 2024

Two things jump out from a quick glance

  • authenticatorSelection for createPasskey doesn't require resident keys. Most likely this is fine, but it'd be interesting to try creating a passkey with the exact same configuration than what is here to eliminate this variable
  • attestation: "direct" is passed in; let's try without it? Again I don't see a problem with that in principle, but anything you can do to remove differences will help isolate the problem

The rest of your code looks good to me; I bet the issue, if not related to createPasskey params somehow, is going to be related to the setup you're testing with: are you testing locally with a signed APK? Deploying into a test device? I've run into many issues testing on Android emulators in particular so I'd recommend actually building the signed APK, and install it on a dev-enabled device to remove any weirdness.

@vikasvk3510
Copy link
Author

vikasvk3510 commented Nov 8, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Nov 8, 2024

@vikasvk3510 great news! Mind sharing what was the problem and how you got around it?

Re: public key coordinates: can you be more specific about where you see this "showing in web"? Are you referring to Turnkey API responses? Or a demo app? Also: which key do you want to display pubkey coordinates for?

@vikasvk3510
Copy link
Author

vikasvk3510 commented Nov 11, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Nov 11, 2024

Interesting, thanks for sharing! The only difference between this and what you had before seems to be the removal of "attestation: direct" from the config passed to createPasskey? Anything else besides that? (any changes in your HTTP server or device/test setup which wouldn't be captured by an app code change?)

@vikasvk3510
Copy link
Author

vikasvk3510 commented Nov 13, 2024 via email

@r-n-o
Copy link
Collaborator

r-n-o commented Nov 16, 2024

It's going to be difficult for me to help without further details. By "opening" passkeys you mean during authentication? Or registration? It'd be helpful to know how you're testing exactly because it will affect what you can and can't do on iOS.

One thing that's iOS specific is the provisioning profile and app signing process: without that in place I don't think passkeys will work. Another thing to check is the app entitlements. Unfortunately these are "off the cuff" recommendations, I'm not sure they'll fix the issue you're seeing (they're just things that have bitten me before)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants