الحصول على بيانات اعتماد التفويض
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يجب أن يملك تطبيقك بيانات اعتماد التفويض لتتمكّن من استخدام YouTube Reporting API أو YouTube Analytics API.
يوضِّح هذا المستند الأنواع المختلفة من بيانات اعتماد التفويض التي تتوافق معها وحدة تحكُّم واجهة برمجة تطبيقات Google. كما يشرح كيفية العثور على بيانات اعتماد التفويض أو إنشائها لمشروعك.
أنشِئ مشروعك واختَر خدمات واجهة برمجة التطبيقات.
- افتح صفحة بيانات الاعتماد في وحدة تحكُّم واجهة برمجة التطبيقات.
-
تتيح لك الصفحة إنشاء نوعين مختلفين من بيانات الاعتماد.
مع ذلك، إنّ جميع طرق استخدام واجهة برمجة التطبيقات YouTube Reporting API وYouTube Analytics API تتطلّب الحصول على إذن OAuth 2.0.
اتّبِع التعليمات أدناه لإنشاء بيانات اعتماد OAuth 2.0.
-
OAuth 2.0: عندما يطلب تطبيقك بيانات خاصة للمستخدمين، يجب أن يرسل رمز OAuth 2.0 المميز مع الطلب. يرسل تطبيقك أولاً معرّف العميل، وربما سر العميل للحصول على رمز مميّز. يمكنك إنشاء بيانات اعتماد OAuth 2.0 لتطبيقات الويب أو حسابات الخدمة أو التطبيقات المثبّتة.
لمزيد من المعلومات، راجِع مستندات OAuth 2.0.
-
مفاتيح واجهة برمجة التطبيقات:
يمكنك تضمين مفتاح واجهة برمجة التطبيقات مع الطلب.
يعرّف المفتاح مشروعك ويوفر إمكانية الوصول إلى واجهة برمجة التطبيقات والحصص والتقارير.
تجدر الإشارة إلى أنّ جميع طرق استخدام واجهة برمجة التطبيقات لإعداد التقارير في YouTube وYouTube Analytics API تتطلّب الحصول على تفويض OAuth 2.0.
لهذا السبب، عليك اتّباع التعليمات الواردة أعلاه
لإنشاء بيانات اعتماد OAuth 2.0. ويمكنك أيضًا إرسال
مفتاح واجهة برمجة التطبيقات، إلا أنّ هذا الإجراء ليس ضروريًا.
تتيح واجهة برمجة التطبيقات عدة أنواع من القيود المفروضة على مفاتيح واجهة برمجة التطبيقات. إذا لم يكن مفتاح واجهة برمجة التطبيقات الذي تحتاجه متوفرًا، يمكنك إنشاء مفتاح واجهة برمجة التطبيقات في وحدة التحكّم من خلال النقر على إنشاء بيانات اعتماد
> مفتاح واجهة برمجة التطبيقات. يمكنك حظر المفتاح قبل استخدامه
في مرحلة الإنتاج من خلال النقر على تقييد المفتاح واختيار أحد
القيود.
للحفاظ على أمان مفاتيح واجهة برمجة التطبيقات، يُرجى اتّباع أفضل الممارسات
لاستخدام مفاتيح واجهة برمجة التطبيقات بأمان
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eApplications need authorization credentials to use the YouTube Reporting API or the YouTube Analytics API.\u003c/p\u003e\n"],["\u003cp\u003eThe Google API Console supports different types of credentials, but the YouTube Reporting API and YouTube Analytics API require OAuth 2.0 authorization.\u003c/p\u003e\n"],["\u003cp\u003eOAuth 2.0 credentials, which involve a client ID and potentially a client secret, are needed for applications requesting private user data.\u003c/p\u003e\n"],["\u003cp\u003eAPI keys can be used to identify a project and provide API access, but are not necessary for the YouTube Reporting API and the YouTube Analytics API.\u003c/p\u003e\n"],["\u003cp\u003eYou can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.\u003c/p\u003e\n"]]],["To use the YouTube Reporting or Analytics APIs, applications need authorization credentials. Navigate to the Credentials page in the Google API Console to create them. While API keys can be created and optionally used, OAuth 2.0 credentials are required for all methods in these APIs. Generate OAuth 2.0 credentials, including a client ID and secret. API keys identify your project and can be restricted for security, but are not a replacement for OAuth 2.0 tokens.\n"],null,["# Obtain authorization credentials\n\nYour application must have authorization credentials to be able to use the YouTube Reporting API or the YouTube Analytics API.\n\nThis document describes the different types of authorization credentials that the [Google API Console](https://console.cloud.google.com/) supports. It also explains how to find or create authorization credentials for your project.\n\nCreate your project and select API services\n-------------------------------------------\n\n1. Open the [Credentials page](https://console.cloud.google.com/apis/credentials) in the API Console.\n2. The page allows you to create two different types of credentials. However, all of the methods for the YouTube Reporting API and the YouTube Analytics API require OAuth 2.0 authorization. Follow the instructions below to generate OAuth 2.0 credentials.\n - **OAuth 2.0:** Whenever your application requests private user\n data, it must send an OAuth 2.0 token along with the request. Your\n application first sends a client ID and, possibly, a client secret to\n obtain a token. You can generate OAuth 2.0 credentials for web\n applications, service accounts, or installed applications.\n\n For more information, see the [OAuth 2.0 documentation](https://developers.google.com/identity/protocols/OAuth2).\n - **API keys:**\n\n You have the option of including an API key with a request.\n\n The key identifies your project and provides API access, quota, and\n reports.\n\n\n Note that all of the methods for the YouTube Reporting API and the\n YouTube Analytics API require OAuth 2.0 authorization.\n\n\n For that reason, you need to follow the instructions above for\n generating OAuth 2.0 credentials. If you want, you can also send an\n API key, but that's not necessary.\n\n The API supports several types of restrictions on API keys. If the API key that you\n need doesn't already exist, then create an API key in the Console by\n clicking **[Create credentials](https://console.cloud.google.com/apis/credentials) \\\u003e API key** . You can restrict the key before using it\n in production by clicking **Restrict key** and selecting one of the\n **Restrictions**.\n\nTo keep your API keys secure, follow the [best practices for\nsecurely using API keys](//cloud.google.com/docs/authentication/api-keys)."]]