Skip to content

docs(auth): guia passo-a-passo de ativação SSO pré-deploy (F1-1.x)#105

Merged
adm01-debug merged 1 commit into
mainfrom
docs/auth-sso-todo
May 9, 2026
Merged

docs(auth): guia passo-a-passo de ativação SSO pré-deploy (F1-1.x)#105
adm01-debug merged 1 commit into
mainfrom
docs/auth-sso-todo

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

Plano

Adiciona docs/AUTH-SSO-ACTIVATION.md (236 linhas) — complemento direto do PR #104 que removeu Lovable Auth.

Documento serve como runbook pra ativar SSO Google em produção em ~30min, executável por qualquer pessoa com acesso ao painel Supabase + Google Cloud Console.

Conteúdo

Seção Conteúdo
📋 Checklist resumido 6 passos numerados (5 obrigatórios + 1 opcional)
Passo 1 OAuth Client ID no Google Cloud Console (com OAuth Consent Screen)
Passo 2 Authorized redirect URIs + JavaScript origins
Passo 3 Habilitar provider Google no Supabase + URL Configuration
Passo 4 Sanidade das variáveis de ambiente
Passo 5 Smoke test manual passo-a-passo
Passo 6 (opcional) Adicionar Apple Sign-In (UI + Apple Developer + Supabase)
🔁 Reversão 2 opções de rollback rápido (30s ou 1 linha)
Erros possíveis Tabela de 5 erros comuns + solução pra cada

Decisões refletidas no documento

  • Apple Sign-In separado e opcional (tem custo de ~3-4h pra implementar UI + config Apple Developer; não é bloqueante)
  • Secrets ficam só no Supabase, não no código (boa prática)
  • Email/senha continua 100% durante toda a ativação SSO (zero downtime)
  • Rollback em 30 segundos via toggle Supabase, sem precisar deploy

Risk

🟢 Zero. Apenas documentação. Nenhum código alterado.

Test plan

  • Markdown válido (sem bold/header/list quebrado)
  • Links externos checados (Supabase + Google docs)
  • Passos numerados e ordenados (Google Cloud → Supabase → smoke test)
  • CI verde (aguardando)
  • CodeRabbit revisão (sugestões de clareza/completude bem-vindas)

Próximos PRs relacionados

Junto com #104 (cleanup/remove-lovable-auth), este PR fecha o GAP de auth identificado na auditoria de Maio/2026.

Outros PRs em aberto:

Complemento direto do PR #104 (cleanup/remove-lovable-auth).

Documento detalha como ativar SSO Google em produção via Supabase nativo,
em ~30min, sem precisar de código novo:

1. Criar OAuth Client ID no Google Cloud (passo 1)
2. Configurar redirect URIs (passo 2)
3. Habilitar provider Google no Supabase (passo 3)
4. Variáveis de ambiente (sanidade) (passo 4)
5. Smoke test manual (passo 5)
6. Apple Sign-In (opcional, passo 6) — requer implementar botão na UI primeiro

Inclui troubleshooting (erros comuns + solução) e procedimento de rollback
em 30 segundos (toggle Supabase) ou 1 linha de código (esconder botão).

**Risk**: zero (apenas documentação, nenhum código alterado).

**Test plan**: revisão manual do conteúdo + verificação dos links externos
(Supabase docs, Google docs).
Copilot AI review requested due to automatic review settings May 9, 2026 14:47
@vercel
Copy link
Copy Markdown

vercel Bot commented May 9, 2026

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

Project Deployment Actions Updated (UTC)
promo-gifts Ready Ready Preview, Comment May 9, 2026 2:48pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

Warning

Rate limit exceeded

@adm01-debug has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minute and 44 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f16b8077-7bcf-4385-b060-ce76fb280690

📥 Commits

Reviewing files that changed from the base of the PR and between 7e29078 and 5cd4f6d.

📒 Files selected for processing (1)
  • docs/AUTH-SSO-ACTIVATION.md

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: String must contain at most 250 character(s) at "tone_instructions"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cd4f6d523

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

```
https://promogifts.com.br/auth/callback
https://www.promogifts.com.br/auth/callback
https://app.promogifts.com.br/auth/callback
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't advertise app domain until it uses Supabase OAuth

If production is served from app.promogifts.com.br, following this runbook still won't enable the documented Supabase Google flow: src/components/auth/SocialLoginButtons.tsx only treats *.atomicabr.com.br, promogifts.com.br, and www.promogifts.com.br as self-hosted, so app.promogifts.com.br falls through to the Lovable broker instead of supabase.auth.signInWithOAuth. This domain should either be removed from the activation guide or the routing predicate should include it before operators rely on this checklist.

Useful? React with 👍 / 👎.

@adm01-debug adm01-debug merged commit af90dfb into main May 9, 2026
16 of 18 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new operational runbook to guide pre-deploy activation of Google SSO (Supabase Auth) in production, intended to close the “SSO activation” gap after the Lovable Auth removal work.

Changes:

  • Adds docs/AUTH-SSO-ACTIVATION.md with a step-by-step checklist for Google OAuth setup (Google Cloud Console → Supabase → smoke test).
  • Documents rollback options and a troubleshooting table for common auth errors.
  • Includes an optional section outlining what would be needed to add Apple Sign-In.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,236 @@
# 🔐 Ativação SSO em Produção — Guia Pré-Deploy

**Status:** SSO desabilitado em código. Login social (botão "Continuar com Google") está visível na UI mas vai retornar erro `Provider not enabled` até este guia ser executado.
Comment on lines +77 to +84
## Passo 2 — Redirect URIs adicionais

Se a Promo Brindes for usar **subdomínios diferentes em produção**, adicione cada um na lista de `Authorized redirect URIs` do Google + também configure na lista de `Site URL` do Supabase (Passo 3).

Exemplos comuns que talvez precisem entrar:
- `https://promo-gifts-staging.atomicabr.com.br` (staging)
- `https://promo-gifts-pr-*.vercel.app` (Vercel preview deploys — opcional, pode usar wildcard)

Comment on lines +152 to +155
| `redirect_to is not allowed` | URL atual não está em Redirect URLs | Adicionar em Supabase URL Config |
| `redirect_uri_mismatch` (na tela do Google) | URL atual não está em Authorized redirect URIs do Google | Adicionar em Google Cloud Console |
| `Sessão não estabelecida` (toast no app, após 8s) | OAuth callback funcionou mas Supabase não conseguiu trocar code por session | Ver logs do Supabase Auth |
| Loop redirect infinito | `Site URL` mal configurado no Supabase | Confirmar que `Site URL` é só a raiz, sem `/auth/callback` |
Comment on lines +161 to +162
⚠️ **Apple Sign-In NÃO está implementado na UI do PromoGifts atualmente.** Existe apenas como tipo no SDK que removemos. Pra ativar, é preciso:

@adm01-debug adm01-debug deleted the docs/auth-sso-todo branch May 9, 2026 21:29
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