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がスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
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)
- 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 causesredirect_uri_mismatch. - Use the real scope. Gmail send is
https://www.googleapis.com/auth/gmail.send(NOThttps://gmail.com/..., which doesn't exist). Addopenid https://www.googleapis.com/auth/userinfo.emailif you want the account address auto-filled.
Flow
- 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.
- 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=consentare required for a refresh token (otherwise re-auth is needed when the access token expires). - Send the operator the returned
authUrlto click. - Await the redirect — it exchanges the code and seals the tokens:
If it returns statusoauth_authorize({ action: "await", flowId: "<flowId from start>" })pending, the operator hasn't clicked yet — tell them, then callawaitagain.
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:
- Check what's connected:
oauth_authorize({ action: "status" })→ lists each account (provider, email, scopes, expiry). No secrets. - Get a usable token:
oauth_authorize({ action: "token", provider: "google-gmail" })→ returnsaccessToken. It auto-refreshes from the sealed refresh token when the old one expired, so you always get a live token. (Passprovideronly if more than one account is connected.) - Call the API with it. Gmail send:
POST https://gmail.googleapis.com/gmail/v1/users/me/messages/send, headerAuthorization: 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
コメント
- …
このリポジトリの他のスキル
1password
11kエージェントが、1Passwordのコマンドラインツールを設定し、安全にサインインできるようにしたうえで、必要なときに保存された秘密情報を読み取るか、注入できるよう支援します。
apple-reminders
11kエージェントが、ターミナルからAppleのリマインダーを表示、追加、編集、完了、削除できるよう支援します。リストや日付による絞り込みも含みます。
bluebubbles
11kエージェントが、BlueBubblesを通じてiMessageの送信と管理を行えるよう支援します。テキスト、添付ファイル、タップバックのリアクション、編集、グループ設定を含みます。
camsnap
11kエージェントが、すでに設定済みのネットワーク防犯カメラから、スナップショット、短い動画、動きの監視を行えるよう支援します。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。