- Newest
- Most votes
- Most comments
Based on your description, it seems you're encountering issues with the CompleteWebAuthnRegistrationCommand when trying to implement passkeys with AWS Cognito using your custom security page.
The error "InvalidParameterException: Credential data is not valid" typically indicates that the credential object you're passing doesn't match what Cognito expects. When working with passkeys in Cognito, the credential format is very specific.
Here are a few things to check:
-
Make sure the credential object structure matches exactly what Cognito expects. The credential parameter should be a base64-encoded string representation of the credential object, not the raw JavaScript object.
-
The credential object needs to be properly serialized. Try converting your credential object to a JSON string and then encoding it to base64 before passing it to the CompleteWebAuthnRegistrationCommand.
-
Check that your accessToken is valid and not expired.
-
Ensure that your user pool is properly configured for passkeys. If you've migrated from an older "lite" plan to "Essentials", there might be underlying configuration issues even if passkey registration appears to be enabled.
-
Verify that the attestation object and client data JSON are properly formatted and encoded.
Since you mentioned that setting up passkeys with the hosted page works, you might want to use browser developer tools to capture the exact request format that the hosted UI sends when successfully registering a passkey. This can serve as a reference for your custom implementation.
If you continue to face issues, you might need to contact AWS Support for more specific guidance, as there could be subtle configuration issues with your user pool that are difficult to diagnose without more information.
Sources
Cognito pool migration legacy/lite to essentials - passkeys not working | AWS re:Post
answered a year ago
Relevant content
asked 10 months ago
