Duckinm / nextjs-auth-cognito

NextJS integration with Amazon Cognito that features user registration and password reset.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

*If you would like to support these tutorials, you can contribute to my Patreon account

NextJS Authentication with Amazon Cognito

This project is built on top of NextJS and is integrated with Amazon Cognito to provide AuthComponent functionality such as signup, signin, and password reset.

Amazon Cognito

For the Authentication features to work, you must have an AWS account to use the Cognito service.

Create a Cognito User pool, App client, and setup the domain.

Finally, open the file .env and update the values being asked.

Note: We are using SSR Support for AWS Amplify JavaScript Libraries
To get the token in the API. This can be useful when we want our NextJS API to act as a gateway and forward the request to an external API with the bearer token.

Getting Started

Install the dependencies:

yarn install

Run the development server:

yarn dev

Open http://localhost:3000 with your browser and navigate to the signin page. Note that you must have already added test emails in Google for testing.

After successfully signing in, the API can be access at: http://localhost:3000/api/authtest

Definition of Terms

References

About

NextJS integration with Amazon Cognito that features user registration and password reset.


Languages

Language:JavaScript 97.6%Language:CSS 2.0%Language:Shell 0.3%