amazon-cognito-auth-js | Amazon Cognito Auth SDK for JavaScript simplifies | Authentication library
kandi X-RAY | amazon-cognito-auth-js Summary
kandi X-RAY | amazon-cognito-auth-js Summary
The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps. Instead of implementing a UI for sign-up and sign-in, this SDK provides the UI via a hosted page. It supports sign-up, sign-in, confirmation, multifactor authentication, and sign-out.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of amazon-cognito-auth-js
amazon-cognito-auth-js Key Features
amazon-cognito-auth-js Examples and Code Snippets
Community Discussions
Trending Discussions on amazon-cognito-auth-js
QUESTION
I am writing here to ask for help or at least a clarification.
I work at a startup and a couple of weeks ago we launched our SaaS. We manage all our users with Aws Cognito. I'm using amazon-cognito-identity-js
for the authentication on the frontend and both sign-up and sign-in work fine. We want to add social sign-in (OAuth) through Google and for that I'm using aws-amplify-js
, calling Auth.federatedSignIn({provider: 'Google'})
as specified in Amplify docs.
The first time a user sign in with Google, a new user is correctly created in Cognito, but if I try to sign in again with the same user I get the following error: #error_description=Invalid+user+attributes%3A+email%3A+Attribute+cannot+be+updated.%0A+&error=invalid_request
.
Apparently this is a rather common issue:
- https://github.com/amazon-archives/amazon-cognito-auth-js/issues/159
- https://github.com/amazon-archives/amazon-cognito-auth-js/issues/48
- https://github.com/aws-amplify/amplify-js/issues/3526
After looking for a solution I believe this happens because when we created our User Pool we set email
as a required attribute and it was automatically set as immutable. Apparently if you want to use social sign-in every attribute should be mutable (as specified here because on every new sign in Cognito tries to update them.
So now we're stuck. It's not possible to change email
attribute from immutable
to mutable
for an existing User Pool and as far as I know it's not possible to prevent Auth.federatedSignIn({provider: 'Google'})
to update every user attributes.
We cannot simply delete and recreate our User Pool because we're already in production and we got several users already registered. Is there any possible solution or workaround to fix this? Any kind of suggestion would be very helpful!
...ANSWER
Answered 2021-Sep-15 at 07:24As of now there is nothing more you could do then to migrate all the users to another User Pool.
For users using federated sign in this won't change anything. You don't store their passwords so they won't see any difference.
The problem starts with users for which you has passwords. While you can migrate them to another pool, they will have to set up a new password.
You could write a simple script that could create a CSV file with the user data and then use the import function of the new User Pool to import all users. All non-federate users will then need to set new password.
You can just notify all of them that this will be happening because the whole operation will involve some downtime (since you don't want the two pools to get out of sync).
QUESTION
I am working on a feature of refreshing token once it's expire. I used amazon-cognito-auth-js to do the authorization and check here as an example, I implemented the below method to refresh token. however it doesn't work. Below is my code, and the session doesn't refresh as I expected. There is no synax error, just the auth token still expired. By the way, I use react.
...ANSWER
Answered 2021-Mar-19 at 22:44Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install amazon-cognito-auth-js
Download the JavaScript libraries and include them in your HTML, or
Install the dependencies with npm and use a bundler like webpack.
This method is simpler and does not require additional tools, but may have worse performance due to the browser having to download multiple files.
The Amazon Cognito Auth SDK for JavaScript, from /dist/amazon-cognito-auth.min.js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page