/next-auth-full-example

How to handle with login, logout, token rotation (revalidate token with refresh token) and roles and permissions with NextJs,

Primary LanguageTypeScript

Next authentication with an existent backend

Based on this Rocketseat example

This examples shows how we can handle with all the authentication flows with Next. It's includes:

  • login
  • logout
  • token rotation (aka refresh tokens)
  • validate user roles and permissions
  • retry the requests that are failed while the application was revalidating the token.

Instructions

First clone and try to run the backend mock:

git clone git@github.com:rocketseat-education/ignite-reactjs-next-auth-jwt.git
yarn && yarn dev

After, install all dependencies using yarn and run the next application.

git clone git@github.com:Domeniqque/next-auth-full-example.git
yarn && yarn dev

Finally, try sign in using the credentials in server database.ts file.