Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/renanstn/nextjs-oauth-study
Estudos aleatórios para aprender nextjs, next-auth e cypress.
https://github.com/renanstn/nextjs-oauth-study
next-auth nextjs oauth oauth2 react reactjs
Last synced: about 2 months ago
JSON representation
Estudos aleatórios para aprender nextjs, next-auth e cypress.
- Host: GitHub
- URL: https://github.com/renanstn/nextjs-oauth-study
- Owner: renanstn
- Created: 2024-09-04T01:10:16.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-17T12:12:47.000Z (4 months ago)
- Last Synced: 2024-09-17T21:58:18.620Z (4 months ago)
- Topics: next-auth, nextjs, oauth, oauth2, react, reactjs
- Language: JavaScript
- Homepage:
- Size: 213 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Objetivo
Entender como funciona um fluxo de oauth através do GitHub e do Google.
Tentar implementar testes end-to-end passando por estes meios de auth.
## Passos
- Inicializar um projeto next.js
- `npx create-next-app@latest`
- Implementar testes com Cypress neste template basico
- `npm install cypress --save-dev`
- `npx cypress open`
- Instalar o next-auth
- `npm install next-auth`## ENV file
`.env.local`
```
NEXTAUTH_SECRET=secret!!!GITHUB_SECRET=""
GITHUB_ID=""
```## Tutorial seguido
- https://dev.to/andrews1022/integrate-github-oauth-with-nextauthjs-in-nextjs-13-with-custom-sign-in-out-pages-38mm
- https://docs.cypress.io/guides/end-to-end-testing/google-authentication
## Executando o Cypress
- Precisa estar com o app base rodando
- Abrir o Cypress com o comando `npm run test:e2e:open`
- Executar os testes## Exemplo de configuração do Github oAuth
![github](screenshot.png)