كل الأدلة
OAuth 2.0
سجّل العملاء، نفّذ authorization code flow، وجدّد الرموز للوصول إلى API بصلاحيات التاجر.
تسجيل عميل
افتح بوابة المطورين → Submit app. حدّد redirect URIs والصلاحيات. بعد موافقة HQ، وزّع رابط التثبيت للتجار.
Authorization code flow
وجّه التجار إلى POST /oauth/authorize مع client_id وredirect_uri وscope وstate. استبدل الرمز عند POST /oauth/token.
POST /api/v1/oauth/token
Content-Type: application/json
{
"grant_type": "authorization_code",
"code": "auth_code_from_redirect",
"redirect_uri": "https://your.app/oauth/callback",
"client_id": "mrc_…",
"client_secret": "mcs_…"
}تجديد الرموز
استخدم grant_type refresh_token قبل انتهاء access token. ألغِ الرموز الم compromised عبر POST /oauth/revoke.
مسارات OAuth (مرجعية)
POST /oauth/authorize POST /oauth/token POST /oauth/revoke refresh grant: refresh_token
