Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1.83 KB

README.md

File metadata and controls

48 lines (30 loc) · 1.83 KB

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