Saltar al contenido
Skillpedia
Seguridad11 mil · #11730

oauth-setup

Qué hace

Esta skill guía a la IA para conectar una cuenta que usa inicio de sesión OAuth, como Gmail u otros servicios de Google. Es para personas que quieren que su agente use una cuenta que les pertenece.

Cuándo usarla

  • ✓Cuando quieres que tu agente se conecte a tu Gmail u otro servicio de Google.
  • ✓Cuando quieres conectar cualquier cuenta que use inicio de sesión OAuth.
  • ✓Cuando una conexión OAuth falla con un error de redirección o de permisos.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/spinabot/brigade/blob/main/skills/oauth-setup/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Conecta mi cuenta de Gmail para que el agente pueda enviar correos por mí, y guíame para crear el cliente de Google.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La IA inicia el flujo de inicio de sesión y te da un enlace para aprobar el acceso. Recoge el código de aprobación en un receptor local y guarda los tokens de acceso de forma segura, así que no hay que copiar códigos a mano.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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.

Preguntas frecuentes

¿Qué tipo de cliente de Google necesito?

La skill te pide crear un cliente de aplicación de escritorio en Google Cloud, que funciona con su receptor local de inicio de sesión.

¿Qué permiso de Gmail usa?

Usa el permiso de envío de Gmail, para que el agente pueda enviar correo en tu nombre.

¿Tengo que pegar un código?

No. La skill captura el código de aprobación automáticamente con un receptor local.

Detalles

Descripción original del 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

Popularidad

Estrellas en GitHub
11 mil
Posición en el ranking
#11730
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas