Closed gabrielmaldi closed 1 year ago
Just to add that we're seeing exactly the same issue here.
Invalid device key given
, although interestingly the user is logged in.Quick clarifications here, in the flow, when u login in with a new device are u making sure u remember the device?
Also, Could you try to use ListDevice
api to see if the new device is listed there?
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you. Thank you!
same issue as @TomBonnerAtDerivitec said/described I posted related question on stackoverflow
@TomBonnerAtDerivitec please, take a look at this issue Seems like we're running into the same problem
I met the same issue as well. So I think we have to reopen this issue.
Auth.completeNewPassword
to set a new passwordNow I have to ignore the error for better UE.
By the way, I met the same issue what @TomBonnerAtDerivitec posted above
cc @chrisbonifacio @gabrielmaldi @TomBonnerAtDerivitec
We have re-opened this issue for now, thank you for the feedback. Our team will reach out once they are able to replicate this.
We have re-opened this issue for now, thank you for the feedback. Our team will reach out once they are able to replicate this.
Thanks, look forward to that it can be figured out ASAP!
We have re-opened this issue for now, thank you for the feedback. Our team will reach out once they are able to replicate this.
@abdallahshaban557 Any updates on this?
@samuelcastro - we do not have an update yet. We will provide feedback once our team has gotten a chance to review this further.
Any updates on this? My team is also running into the same issue
Our team seems to also be running into a similar issue. For now had to implent the hacky fix suggested in https://github.com/aws-amplify/amplify-js/issues/2087 (essentially ignoring the "Invalid device key given." error when calling completeNewPassword
). I've confirmed other's observations that despite the error, the password is actually changed successfully.
However is @samuelcastro , any updates?
When this issue was opened, Cognito didn't support device management when doing sign-in with USER_PASSWORD_AUTH
, but now does. As a result, we'll close this issue and point everyone to our documentation regarding the implementation and use of the USER_PASSWORD_AUTH
flow along with the Cognito documentation for further clarity.
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
This issue is a continuation of #2087 which was closed. In that issue, a user stated that the answer to an AWS ticket was:
But I just tested signing in using
USER_PASSWORD_AUTH
which ran my Lambda trigger migration to create the Cognito user, and Amplify sent this request (after successful migration + sign in):With the response being:
200 — { "UserConfirmationNecessary": false }
Thus, it seems Cognito is correctly processing a confirm device request for USER_PASSWORD_AUTH (I see the device in the user's details in the User Pool).
The error occurs when I enable SMS MFA for the user:
1-
InitiateAuth
with the user's credentials returns{ ChallengeName: "SMS_MFA" }
2- Amplify callsRespondToAuthChallenge
with the code the user received via SMS and the response contains{ NewDeviceMetadata: { DeviceGroupKey: "xxx", DeviceKey: "xxx" } }
3- Amplify callsConfirmDevice
just like it does in the no-mfa-flow I described above, but this time the response isInvalidParameterException — Invalid device key given.
So, why is Cognito returning an error this time with the same USER_PASSWORD_AUTH flow, with the only difference being MFA? Is this an issue in Cognito or Amplify? It should be possible to use the migration trigger (which requires USER_PASSWORD_AUTH) and also remember devices (which does work except with MFA).
Thanks!
Expected behavior
A migrated user (which requires USER_PASSWORD_AUTH) should be able to sign in using SMS MFA and with remember-devices enabled in the Cognito User Pool.
Auth.confirmSignIn
should not throw an exception.Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response