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

9 add a cognito user pool #329

Merged
merged 21 commits into from
Nov 12, 2023
Merged

9 add a cognito user pool #329

merged 21 commits into from
Nov 12, 2023

Conversation

Abhiek187
Copy link
Owner

@Abhiek187 Abhiek187 commented Nov 12, 2023

AnimationAfter

I created a user pool, domain, and client in Cognito for the shop app. Then I implemented an OIDC w/ PKCE auth flow with a sign-in and sign-out button on the profile button. When the user signs in, they are taken to a new tab where they enter their credentials. This was made using Cognito's hosted UI. Once authenticated, the user is sent back to the main tab, and the authorization code they get is exchanged for an ID, access, & refresh token that allows the user to sign in. The ID & access tokens are valid for 1 hour (so the user doesn't have to enter their credentials if they sign in within that time) and the refresh token is valid for 30 days. If the user closes the page and reopens it, as long as the refresh token is present and valid, the user will remain signed in. When the user signs out, all the tokens are revoked, so they can't be used with any AWS APIs. There are fail-safes present if the state/nonce is invalid during sign-in or if the refresh token is tampered with.

I restricted public sign-up for now until I'm comfortable with how user profiles are set up. More features will be implemented that utilize these JWTs, such as a profile page.

@Abhiek187 Abhiek187 added documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update Javascript code labels Nov 12, 2023
@Abhiek187 Abhiek187 self-assigned this Nov 12, 2023
@Abhiek187 Abhiek187 linked an issue Nov 12, 2023 that may be closed by this pull request
@Abhiek187 Abhiek187 merged commit 2c3238d into main Nov 12, 2023
13 checks passed
@Abhiek187 Abhiek187 deleted the 9-add-a-cognito-user-pool branch November 12, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update Javascript code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a Cognito user pool
1 participant