-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Unable to find UserAlreadyAuthenticatedException for importing #12727
Comments
Hello @brianreinhold . You can import import { AuthError, signIn } from 'aws-amplify/auth';
try {
await signIn(signInInput)
} catch (error) {
error instanceof AuthError && console.log(error.name, error.message, error.recoverySuggestion)
} |
@brianreinhold, I've also noted this as something to add to our documentation via the docs issue referenced above. Thank you for creating this issue in the event that others run into this! Let us know if @israx's recommendation above resolves the issue for you. |
@israx Does the 'AuthError' object cover the So in resolving the promise with the usual I tried it in the code and using this However, the documentation for the signIn() method only shows the following:
for exceptions. The Also, in version 5 I never got this exception even if I never signed out...which I almost never do. I simply do a ctrl-S in VS code for my Angular project as I update the code and the app restarts with no |
Hey @brianreinhold . Amplify v6 currently maps all service, config, validation and unknown errors into the When it comes to the Thank you for bringing these concerns. We will improve our API docs to be more descriptive. |
Thanks for the info. What has hit me hard is that the user can easily exit the tab without logging out and a restart gives that the user is already authenticate even it it is not the same user (but on the same device). I want to force the user to log in every time. What happens if user A doesnt logout and user B comes on the same device and logs in with his account? I get strange behavior in this situation including a 'DONE' challenge. I am really confused by what is happening here. |
If you want to force your users to login every time, you can use |
This seems to be an undocumented breaking change from v5 to v6. Where in v5 you could call |
is it or |
made my day |
Just solved it as follows:
|
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Doing a signIn() operation aws-amplify throws a
UserAlreadyAuthenticatedException
. The problem is not the exception but I cannot find any documentation on it so I cannot even import it in my attempt to handle it. I guessed my way to this:however
UserAlreadyAuthenticatedException
is not recognized. I need to import it. But so far I have not been able find where to import it from.Here is where the documentation fails. This is not the only object that I have found very difficult to find where it is declared. This one has been so difficult I have still not found it.
Expected behavior
The documentation would provide the necessary imports so one can handle errors.
Reproduction steps
Search the documentation.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: