본문으로 건너뛰기
Skillpedia
보안11k · #11730

oauth-setup

하는 일

이 스킬은 Gmail이나 다른 Google 서비스처럼 OAuth 로그인을 쓰는 계정을 연결하도록 AI를 안내합니다. 자신이 소유한 계정을 에이전트가 쓰게 하려는 사람들을 위한 스킬입니다.

사용하는 경우

  • ✓에이전트가 내 Gmail이나 다른 Google 서비스에 연결되기를 원할 때.
  • ✓OAuth 로그인을 쓰는 계정을 연결하고 싶을 때.
  • ✓OAuth 연결이 리디렉션이나 권한 범위 오류로 실패할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/spinabot/brigade/blob/main/skills/oauth-setup/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“에이전트가 저를 대신해 이메일을 보낼 수 있도록 제 Gmail 계정을 연결해 주세요. Google 클라이언트를 만드는 방법도 단계별로 안내해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 로그인 흐름을 시작하고 권한을 승인할 링크를 줍니다. 로컬 리스너가 승인 코드를 받아 로그인 토큰을 안전하게 저장하므로, 코드를 직접 옮겨 적을 필요가 없습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.

자주 묻는 질문

어떤 종류의 Google 클라이언트가 필요한가요?

Google Cloud에서 데스크톱 앱 클라이언트를 만들라고 안내하며, 이는 로컬 로그인 리스너와 잘 맞습니다.

어떤 Gmail 권한을 쓰나요?

Gmail 보내기 권한을 쓰므로, 에이전트가 나를 대신해 메일을 보낼 수 있습니다.

코드를 붙여 넣어야 하나요?

아닙니다. 스킬은 로컬 리스너를 통해 승인 코드를 자동으로 받습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
11k
순위
#11730
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬