/nextauth

Exemplo de Login com o Nextjs e JWT e refresh Token

Primary LanguageTypeScript

Authentication with JSON Web Token (JWT)

In this Rocketseat example, we configure nextjs with axios to login to a backend via the JWT token. We handled various errors such as Expired Token, Invalid Token and created the refresh Token function to renew the token if it is expired.

Neste exemplo da Rocketseat, configuramos o nextjs com o axios para fazer login num backend através do token JWT. Tratamos vários erros, como Token expirado, Token inválido e criamos a função de refresh Token, para renovar o token caso esteja expirado.

Technologies

How Run It

Running Project

  1. Clone example Backend and install dependencies using npm i or yarn
  2. Run command npm run dev on backend folder
  3. Clone this project and install dependencies using npm i or yarn
  4. Run command npm run dev on folder of this project