รับข้อมูลเข้าสู่ระบบสำหรับการให้สิทธิ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
แอปพลิเคชันของคุณต้องมีข้อมูลเข้าสู่ระบบการให้สิทธิ์เพื่อให้สามารถใช้ API การรายงานของ YouTube หรือ YouTube Analytics API ได้
เอกสารนี้จะอธิบายข้อมูลรับรองการให้สิทธิ์ประเภทต่างๆ ที่คอนโซล Google API รองรับ นอกจากนี้ยังอธิบายวิธีค้นหาหรือสร้างข้อมูลเข้าสู่ระบบการให้สิทธิ์สำหรับโปรเจ็กต์ของคุณด้วย
สร้างโปรเจ็กต์และเลือกบริการ API
- เปิดหน้าข้อมูลเข้าสู่ระบบในคอนโซล API
-
หน้านี้จะให้คุณสร้างข้อมูลเข้าสู่ระบบ 2 ประเภท
แต่เมธอดทั้งหมดสำหรับ YouTube Reporting API และ API ของ YouTube Analytics จำเป็นต้องมีการให้สิทธิ์ OAuth 2.0
ทำตามวิธีการด้านล่างเพื่อสร้างข้อมูลเข้าสู่ระบบ OAuth 2.0
-
OAuth 2.0: เมื่อใดก็ตามที่แอปพลิเคชันขอข้อมูลส่วนตัวของผู้ใช้ แอปพลิเคชันจะต้องส่งโทเค็น OAuth 2.0 ไปกับคำขอด้วย แอปพลิเคชันของคุณจะส่งรหัสไคลเอ็นต์และอาจมีรหัสลับไคลเอ็นต์เพื่อรับโทเค็น คุณสร้างข้อมูลเข้าสู่ระบบ OAuth 2.0 สำหรับเว็บแอปพลิเคชัน บัญชีบริการ หรือแอปพลิเคชันที่ติดตั้งไว้ได้
โปรดดูข้อมูลเพิ่มเติมในเอกสารประกอบเกี่ยวกับ OAuth 2.0
-
คีย์ API:
คุณมีตัวเลือกในการใส่คีย์ API ไปกับคำขอ
คีย์จะระบุโปรเจ็กต์และให้สิทธิ์เข้าถึง API, โควต้า และรายงาน
โปรดทราบว่าเมธอดทั้งหมดสำหรับ YouTube Reporting API และ API ของ YouTube Analytics จำเป็นต้องมีการให้สิทธิ์ OAuth 2.0
ด้วยเหตุนี้ คุณจึงต้องทำตามวิธีการด้านบนเพื่อสร้างข้อมูลเข้าสู่ระบบ OAuth 2.0 คุณจะส่งคีย์ API ด้วยก็ได้หากต้องการ แต่ไม่จำเป็น
API รองรับข้อจำกัดหลายประเภทเกี่ยวกับคีย์ API หากคีย์ API ที่คุณต้องการยังไม่มีอยู่ ให้สร้างคีย์ API ในคอนโซลโดยคลิกสร้างข้อมูลเข้าสู่ระบบ
> คีย์ API คุณจำกัดคีย์ก่อนนำไปใช้ในเวอร์ชันที่ใช้งานจริงได้โดยคลิกจำกัดคีย์ แล้วเลือกข้อจำกัดรายการใดรายการหนึ่ง
หากต้องการรักษาคีย์ API ให้ปลอดภัย ให้ทำตามแนวทางปฏิบัติแนะนำสำหรับการใช้คีย์ API อย่างปลอดภัย
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-21 UTC
[null,null,["อัปเดตล่าสุด 2025-08-21 UTC"],[[["\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,["Your 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\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)."]]