/next-amplify-sample-app

Amplify/Cognito with Descope in a Next 13 App (without the Hosted UI)

Primary LanguageTypeScriptMIT LicenseMIT

Cognito and Descope Banner

This sample app is an open-source sample app, built with Next 13 and the Amplify SDK. You can deploy this SSR app in Amplify with the button below. This project also showcases how to store and display user information on a dashboard page and use Next 13's app routing with the Amplify SDK.

You can one-click deploy this app in Amplify, but you'll also need to set up your Cognito User Pool and Amplify Settings in order for the app to work properly. You can do so by following the guide here.

amplifybutton

Table of Contents 📝

  1. Features
  2. Installation
  3. Running the Application
  4. Issue Reporting

Features ✨

  • Descope Login: Users can log in with their Descope credentials.
  • User Dashboard: After logging in, users are redirected to a dashboard that displays the information of the logged-in user.

Installation 💿

  1. Clone the repository:
git clone https://github.com/descope-sample-apps/cognito-next-sample-app.git
  1. Install dependencies:
yarn install
  1. Setup environment variables:

Use the .env.example file in the repo, and change the name to .env. Then, fill in the following variables with your own information:

  1. NEXT_PUBLIC_USER_POOL_ID - This will be your User Pool ID from Cognito (e.g. us-west-2_ifNfd3LI)
Monosnap App integration   sample-app-prod   User pools 2023-10-23 09-31-40
  1. NEXT_PUBLIC_AWS_REGION - Your AWS Region (e.g. us-west-1)
Monosnap App integration   sample-app-prod   User pools 2023-10-23 09-32-24
  1. NEXT_PUBLIC_USER_POOL_CLIENT_ID - Your User Pool Client ID of the app that you created in your user pool settings.
Monosnap App integration   sample-app-prod   User pools 2023-10-23 09-33-00
  1. NEXT_PUBLIC_OAUTH_DOMAIN - This is the Cognito domain of your user pool. (e.g. next-1-dev.auth.us-west-2.amazoncognito.com)
Monosnap App integration   sample-app-prod   User pools 2023-10-23 09-31-09

Running the Application 🚀

To start the application, run:

yarn dev

Navigate to http://localhost:3000/ in your browser.

Issue Reporting ⚠️

For any issues or suggestions, feel free to open an issue in the GitHub repository.

License 📜

This project is licensed under the MIT License - see the LICENSE file for details.