Pular para o conteúdo
Skillpedia
Segurança11 mil · #11730

oauth-setup

O que ela faz

Esta skill guia a IA na conexão de uma conta que usa login OAuth, como o Gmail ou outros serviços do Google. Ela é para quem quer que o agente use uma conta que é sua.

Quando usar

  • ✓Quando você quer que seu agente se conecte ao seu Gmail ou a outro serviço do Google.
  • ✓Quando você quer conectar qualquer conta que use login OAuth.
  • ✓Quando uma conexão OAuth falha com um erro de redirecionamento ou de escopo.

Link da skill

https://github.com/spinabot/brigade/blob/main/skills/oauth-setup/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/spinabot/brigade/blob/main/skills/oauth-setup/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Conecte minha conta do Gmail para que o agente possa enviar e-mails por mim, e me guie na criação do cliente do Google.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A IA inicia o fluxo de login e te entrega um link para aprovar o acesso. Ela captura o código de aprovação em um listener local e guarda os tokens de acesso com segurança, para que os códigos não precisem ser copiados à mão.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

OAuth setup

Use the oauth_authorize tool — NEVER hand-roll an http listener in bash. It opens a one-shot loopback listener on a free port (no EADDRINUSE, no port juggling), captures the code, and seals the tokens into the credential store.

The two mistakes to avoid (they cost a whole session once)

  1. Use a Desktop-app OAuth client, not a Web client. In Google Cloud Console → Credentials → Create OAuth client ID → Application type: Desktop app. Desktop clients accept ANY http://127.0.0.1:<port> loopback redirect with no redirect-URI registration. A Web client requires the exact redirect URI pre-registered, which is what causes redirect_uri_mismatch.
  2. Use the real scope. Gmail send is https://www.googleapis.com/auth/gmail.send (NOT https://gmail.com/..., which doesn't exist). Add openid https://www.googleapis.com/auth/userinfo.email if you want the account address auto-filled.

Flow

  1. Ask the operator to create a Desktop-app OAuth client (Gmail API enabled, consent screen in Testing with themselves as a test user) and paste the client id + secret.
  2. Start the flow:
    oauth_authorize({
      action: "start",
      provider: "google-gmail",
      authorizationEndpoint: "https://accounts.google.com/o/oauth2/v2/auth",
      tokenEndpoint: "https://oauth2.googleapis.com/token",
      userInfoEndpoint: "https://www.googleapis.com/oauth2/v3/userinfo",
      clientId: "<id>", clientSecret: "<secret>",
      scopes: ["https://www.googleapis.com/auth/gmail.send", "openid", "https://www.googleapis.com/auth/userinfo.email"],
      extraAuthParams: { access_type: "offline", prompt: "consent" }
    })
    
    access_type=offline + prompt=consent are required for a refresh token (otherwise re-auth is needed when the access token expires).
  3. Send the operator the returned authUrl to click.
  4. Await the redirect — it exchanges the code and seals the tokens:
    oauth_authorize({ action: "await", flowId: "<flowId from start>" })
    
    If it returns status pending, the operator hasn't clicked yet — tell them, then call await again.

Using a connected account (sending mail)

The tokens are sealed in the credential store — you can't read them from a file or the DB, and you shouldn't try. To use a connected account:

  1. Check what's connected: oauth_authorize({ action: "status" }) → lists each account (provider, email, scopes, expiry). No secrets.
  2. Get a usable token: oauth_authorize({ action: "token", provider: "google-gmail" }) → returns accessToken. It auto-refreshes from the sealed refresh token when the old one expired, so you always get a live token. (Pass provider only if more than one account is connected.)
  3. Call the API with it. Gmail send: POST https://gmail.googleapis.com/gmail/v1/users/me/messages/send, header Authorization: Bearer <accessToken>, body { "raw": "<base64url RFC-822 message>" }.

Never cat the credential store, grep for the token, or hand-roll a refresh — action:"token" is the only retrieval path, and it keeps the refresh token + client secret sealed.

Perguntas frequentes

Que tipo de cliente do Google preciso criar?

A skill pede que você crie um cliente de aplicativo para desktop no Google Cloud, que funciona com o listener local de login.

Que permissão do Gmail ela usa?

Ela usa a permissão de envio do Gmail, para que o agente possa enviar e-mails em seu nome.

Preciso colar algum código?

Não. A skill captura o código de aprovação automaticamente por meio de um listener local.

Detalhes

Descrição original do autor

Connect an OAuth 2.0 service (Gmail, Google APIs, etc.) using the built-in oauth_authorize tool — get a click-to-authorize link, auto-capture the code, and seal the tokens. Use whenever the operator asks to connect Gmail / a Google API / any OAuth account.

repo: spinabot/brigade

Popularidade

Estrelas no GitHub
11 mil
Posição no ranking
#11730
Licença
MIT
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas