Skip to content

PAV-5: Login social Google (OAuth)#140

Merged
Benevanio merged 6 commits into
Cla-Code-Community:developfrom
jeremiassnts:feature/pav-5
Jun 16, 2026
Merged

PAV-5: Login social Google (OAuth)#140
Benevanio merged 6 commits into
Cla-Code-Community:developfrom
jeremiassnts:feature/pav-5

Conversation

@jeremiassnts

Copy link
Copy Markdown

Descricao

Integra o botao "Entrar com Google" no frontend com o backend OAuth, usando fluxo Full Redirect.

Backend:

  • Corrigido callback OAuth para usar req.session (compartilhado com middleware withSession) em vez de criar instancia separada de getIronSession
  • Callback agora salva session.userId e redireciona ao frontend (res.redirect) em vez de retornar JSON
  • Adicionada variavel de ambiente FRONTEND_URL para controlar o redirect pos-OAuth

Frontend:

  • Adicionada funcao getGoogleAuthUrl() no authService.ts
  • Botao Google nas paginas de login e registro agora inicia o fluxo OAuth ao clicar
  • Criada pagina AuthCallback que detecta a sessao e navega para /app
  • Adicionado refreshUser() no AuthContext para re-buscar /auth/me apos redirect OAuth

Testes:

  • Atualizados testes unitarios e de integracao do auth.controller para esperar redirects (302) em vez de respostas JSON

Linear link

https://linear.app/tatame/issue/PAV-5/login-social-google-oauth

Como foi testado

Testes unitarios e de integracao passando (305/305). Login com Google testado manualmente end-to-end em ambiente local com Docker.

Jeremias Santos and others added 5 commits June 14, 2026 19:23
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Backend: fix callback to use req.session (shared with withSession
  middleware) instead of creating separate getIronSession instance,
  save userId in session, redirect to frontend instead of returning JSON
- Backend: add FRONTEND_URL env var for post-OAuth redirect
- Frontend: add getGoogleAuthUrl() to authService
- Frontend: wire Google button onClick in login and register pages
- Frontend: create AuthCallback page that detects session and
  navigates to /app
- Add AGENTS.md with project rules
- Add design spec and implementation plan docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AuthCallback now re-fetches /auth/me after OAuth redirect to pick up
the newly created session, instead of relying on the initial mount
fetch which runs before the session exists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests now expect 302 redirects instead of JSON responses, and use
req.session instead of getIronSession mock, matching the controller
changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Bene Tesla's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
painel-vagas Ready Ready Preview, Comment Jun 16, 2026 10:47pm

- Add getGoogleAuthUrl tests to authService tests
- Add refreshUser tests to AuthContext tests
- Create AuthCallback page tests (loading, redirect on success/failure)

Brings branch coverage above 80% threshold.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Benevanio Benevanio merged commit ec2e49d into Cla-Code-Community:develop Jun 16, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in JobAtlas – Kanban Jun 16, 2026
Benevanio added a commit that referenced this pull request Jun 16, 2026
## Descricao

Integra o botao "Entrar com Google" no frontend com o backend OAuth,
usando fluxo Full Redirect.

**Backend:**
- Corrigido callback OAuth para usar `req.session` (compartilhado com
middleware `withSession`) em vez de criar instancia separada de
`getIronSession`
- Callback agora salva `session.userId` e redireciona ao frontend
(`res.redirect`) em vez de retornar JSON
- Adicionada variavel de ambiente `FRONTEND_URL` para controlar o
redirect pos-OAuth

**Frontend:**
- Adicionada funcao `getGoogleAuthUrl()` no `authService.ts`
- Botao Google nas paginas de login e registro agora inicia o fluxo
OAuth ao clicar
- Criada pagina `AuthCallback` que detecta a sessao e navega para `/app`
- Adicionado `refreshUser()` no `AuthContext` para re-buscar `/auth/me`
apos redirect OAuth

**Testes:**
- Atualizados testes unitarios e de integracao do `auth.controller` para
esperar redirects (302) em vez de respostas JSON

## Linear link

https://linear.app/tatame/issue/PAV-5/login-social-google-oauth

## Como foi testado

Testes unitarios e de integracao passando (305/305). Login com Google
testado manualmente end-to-end em ambiente local com Docker.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants