التفويض والمصادقة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
ننصحك بشدة باستخدام حساب خدمة للمصادقة عند الدمج مع واجهة SAS Portal API. إذا لزم الأمر،
أنشئ حساب خدمة. احرص على اختيار JSON كنوع المفتاح عند
إنشاء مفتاح حساب الخدمة. بعد اكتمال العملية، سيتم تنزيل مفتاح حساب الخدمة إلى الموقع التلقائي للمتصفّح. بالإضافة إلى ذلك، احرص على
منح دور "مالك المشروع" لحساب الخدمة.
بعد ذلك، عليك تقديم مصادقة حساب الخدمة كرمز مميّز من النوع Bearer. إذا طلبت بيانات من واجهة SAS Portal API مباشرةً، مثلاً من خلال إرسال طلب HTTP باستخدام cURL
، عليك إدخال بيانات المصادقة كرمز مميّز من نوع Bearer في العنوان Authorization
. للحصول على رمز مميّز من النوع Bearer باستخدام حساب الخدمة، اتّبِع الخطوات التالية:
-
ثبِّت
gcloud
، وهي أداة سطر الأوامر.
-
يجب المصادقة على حساب الخدمة. في الأمر التالي، استبدِل
${KEY_FILE} بمسار ملف مفتاح حساب الخدمة:
gcloud auth activate-service-account --key-file ${KEY_FILE}
-
استخدِم حساب الخدمة للحصول على رمز مميّز للتفويض:
gcloud auth print-access-token
يعرض الأمر قيمة رمز الدخول.
-
عند استخدام واجهة برمجة التطبيقات، مرِّر قيمة الرمز المميّز كرمز مميّز من النوع Bearer في عنوان Authorization
. انظر المثال التالي:
curl -X GET -H "X-Goog-User-Project: ${CLIENT_PROJECT}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
"https://sasportal.googleapis.com/v1alpha1/customers"
اضبط قيمة ${CLIENT_PROJECT} على
معرّف مشروع Google Cloud الذي تُجري منه الطلبات، ثم اضبط قيمة
${TOKEN} على رمز التفويض.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eService accounts are the recommended authentication method for integrating with the SAS Portal API, requiring the creation of a service account with a JSON key and granting it the "Project Owner" role.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to the SAS Portal API is done using a Bearer token obtained through the \u003ccode\u003egcloud\u003c/code\u003e command-line tool by activating the service account and printing an access token.\u003c/p\u003e\n"],["\u003cp\u003eWhen calling the API, include the Bearer token in the \u003ccode\u003eAuthorization\u003c/code\u003e header of your request along with the \u003ccode\u003eX-Goog-User-Project\u003c/code\u003e header specifying your Google Cloud Project ID.\u003c/p\u003e\n"]]],["The key actions are creating a service account with a JSON key, granting it the \"Project Owner\" role, and obtaining a Bearer token for API authentication. This is done by installing the `gcloud` tool, authenticating the service account using `gcloud auth activate-service-account --key-file`, and generating an access token via `gcloud auth print-access-token`. This token should then be included in the `Authorization` header when making API calls as a Bearer token.\n"],null,[]]