Skip to content

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

Notifications You must be signed in to change notification settings

czetsuya/nextjs-auth-cognito

Repository files navigation

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.

Blog: https://www.czetsuyatech.com/2022/01/nextjs-secure-application-with-aws-amplify-and-cognito.html

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published