oauth-setup
ما الذي تفعله
توجّه هذه المهارة الذكاء الاصطناعي في ربط حساب يستخدم تسجيل دخول OAuth، مثل Gmail أو خدمات Google الأخرى. وهي لمن يريد أن يستخدم وكيله حساباً يملكه.
متى تستخدمها
- ✓عندما تريد أن يتصل وكيلك بـ Gmail أو خدمة Google أخرى.
- ✓عندما تريد ربط أي حساب يستخدم تسجيل دخول OAuth.
- ✓عندما يفشل اتصال OAuth بخطأ في إعادة التوجيه أو النطاق.
رابط المهارة
https://github.com/spinabot/brigade/blob/main/skills/oauth-setup/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اربط حسابي في Gmail حتى يستطيع الوكيل إرسال الرسائل نيابةً عني، واشرح لي كيف أنشئ عميل Google.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يبدأ الذكاء الاصطناعي تدفق تسجيل الدخول ويعطيك رابطاً للموافقة على الصلاحيات. يلتقط رمز الموافقة عبر مستمع محلي، ويخزن رموز الدخول بأمان، فلا يحتاج الرمز إلى نسخ يدوي.
المحتوى التقني (ملف 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
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
1password
11kيعلّم وكيلك إعداد أداة سطر الأوامر لـ 1Password وتسجيل الدخول بأمان، ثم قراءة الأسرار المخزنة أو إدراجها عند الحاجة.
apple-reminders
11kيتيح لوكيلك عرض التذكيرات في Apple وإضافتها وتعديلها وإكمالها وحذفها من الطرفية، بما فيها القوائم وفلاتر التاريخ.
bluebubbles
11kيتيح لوكيلك إرسال رسائل iMessage وإدارتها عبر BlueBubbles، بما فيها النصوص والمرفقات وردود الفعل السريعة والتعديل وإعدادات المجموعات.
camsnap
11kيتيح لوكيلك التقاط لقطات أو مقاطع قصيرة أو مراقبة الحركة من كاميرات المراقبة الشبكية التي أعددتها بالفعل.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.