OAuth 2.0 āĻ
āύā§āĻŽā§āĻĻāύ āĻŦāĻžāϏā§āϤāĻŦāĻžāϝāĻŧāύ āĻāϰāĻž āĻšāĻā§āĻā§
āϏā§āĻ āĻāϰāĻž āĻĒā§āώā§āĻ āĻž āĻā§āĻāĻŋā§ā§ āϰāĻžāĻāϤ⧠'āϏāĻāĻā§āϰāĻš' āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰā§āύ
āĻāĻĒāύāĻžāϰ āĻĒāĻāύā§āĻĻ āĻ
āύā§āϝāĻžā§ā§ āĻāύā§āĻā§āύā§āĻ āϏā§āĻ āĻāϰā§āύ āĻ āϏāĻ āĻŋāĻ āĻŦāĻŋāĻāĻžāĻā§ āϰāĻžāĻā§āύāĨ¤
YouTube Data API āĻŦā§āϝāĻā§āϤāĻŋāĻāϤ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āϰ āĻĄā§āĻāĻžāϤ⧠āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻ
āύā§āĻŽā§āĻĻāύā§āϰ āĻāύā§āϝ OAuth 2.0 āĻĒā§āϰā§āĻā§āĻāϞ āϏāĻŽāϰā§āĻĨāύ āĻāϰā§ā§ˇ āύāĻŋāĻŽā§āύāϞāĻŋāĻāĻŋāϤ āϤāĻžāϞāĻŋāĻāĻž āĻāĻŋāĻā§ āĻŽā§āϞ OAuth 2.0 āϧāĻžāϰāĻŖāĻž āĻŦā§āϝāĻžāĻā§āϝāĻž āĻāϰā§:
āϝāĻāύ āĻāĻāĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰ⧠āĻĒā§āϰāĻĨāĻŽā§ āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ⧠āĻāĻŽāύ āĻŦā§āĻļāĻŋāώā§āĻā§āϝāĻā§āϞāĻŋ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻžāϰ āĻā§āώā§āĻāĻž āĻāϰ⧠āϝāĻžāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āĻā§ āĻāĻāĻāĻŋ Google Account or YouTube account āϞāĻ āĻāύ āĻāϰāϤ⧠āĻšāĻŦā§, āϤāĻāύ āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻāĻŋ OAuth 2.0 āĻ
āύā§āĻŽā§āĻĻāύ āĻĒā§āϰāĻā§āϰāĻŋāϝāĻŧāĻž āĻļā§āϰ⧠āĻāϰā§ā§ˇ
āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āĻā§ Google āĻāϰ āĻ
āύā§āĻŽā§āĻĻāύ āϏāĻžāϰā§āĻāĻžāϰ⧠āύāĻŋāϰā§āĻĻā§āĻļ āĻāϰā§ā§ˇ āϏā§āĻ āĻĒā§āώā§āĻ āĻžāϰ āϞāĻŋāĻā§āĻāĻāĻŋ āĻ
ā§āϝāĻžāĻā§āϏā§āϏā§āϰ scope
āύāĻŋāϰā§āĻĻāĻŋāώā§āĻ āĻāϰ⧠āϝāĻž āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āϰ āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻā§āϰ āĻāύā§āϝ āĻ
āύā§āϰā§āϧ āĻāϰāĻā§āĨ¤ scope
āϏā§āĻ āϏāĻāϏā§āĻĨāĻžāύāĻā§āϞāĻŋ āύāĻŋāϰā§āĻĻāĻŋāώā§āĻ āĻāϰ⧠āϝāĻž āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ āĻĒā§āϰāĻŽāĻžāĻŖā§āĻā§āϤ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰ⧠āĻšāĻŋāϏāĻžāĻŦā§ āĻāĻžāĻ āĻāϰāĻžāϰ āϏāĻŽāϝāĻŧ āĻĒā§āύāϰā§āĻĻā§āϧāĻžāϰ, āϏāύā§āύāĻŋāĻŦā§āĻļ, āĻāĻĒāĻĄā§āĻ āĻŦāĻž āĻŽā§āĻā§ āĻĢā§āϞāϤ⧠āĻĒāĻžāϰā§āĨ¤
āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰ⧠āϝāĻĻāĻŋ āϏā§āĻ āϏāĻāϏā§āĻĨāĻžāύāĻā§āϞāĻŋ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻāϰāĻžāϰ āĻāύā§āϝ āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻāĻŋāĻā§ āĻ
āύā§āĻŽā§āĻĻāύ āĻāϰāϤ⧠āϏāĻŽā§āĻŽāϤāĻŋ āĻĻā§āϝāĻŧ, Google āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ⧠āĻāĻāĻāĻŋ āĻā§āĻā§āύ āĻĢā§āϰāϤ āĻĻā§āϝāĻŧāĨ¤ āĻāĻĒāύāĻžāϰ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāĻžāύā§āϰ āĻĒā§āϰāĻāĻžāϰā§āϰ āĻāĻĒāϰ āύāĻŋāϰā§āĻāϰ āĻāϰā§, āĻāĻāĻŋ āĻšāϝāĻŧ āĻā§āĻā§āύāĻāĻŋāĻā§ āĻŦā§āϧ āĻāϰ⧠āĻŦāĻž āĻāĻāĻŋāĻā§ āĻāĻāĻāĻŋ āĻāĻŋāύā§āύ āϧāϰāĻŖā§āϰ āĻā§āĻā§āύā§āϰ āĻāύā§āϝ āĻŦāĻŋāύāĻŋāĻŽāϝāĻŧ āĻāϰā§ā§ˇ
āĻāĻĻāĻžāĻšāϰāĻŖāϏā§āĻŦāϰā§āĻĒ, āĻāĻāĻāĻŋ āϏāĻžāϰā§āĻāĻžāϰ-āϏāĻžāĻāĻĄ āĻāϝāĻŧā§āĻŦ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ āĻāĻāĻāĻŋ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻā§āĻā§āύ āĻāĻŦāĻ āĻāĻāĻāĻŋ āϰāĻŋāĻĢā§āϰā§āĻļ āĻā§āĻā§āύā§āϰ āĻāύā§āϝ āĻĢā§āϰāϤ āĻā§āĻā§āύ āĻŦāĻŋāύāĻŋāĻŽāϝāĻŧ āĻāϰā§āĨ¤ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻā§āĻā§āύ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻāĻŋāĻā§ āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āϰ āĻĒāĻā§āώ āĻĨā§āĻā§ āĻ
āύā§āϰā§āϧāĻā§āϞāĻŋ āĻ
āύā§āĻŽā§āĻĻāύ āĻāϰāϤ⧠āĻĻā§āϝāĻŧ āĻāĻŦāĻ āϰāĻŋāĻĢā§āϰā§āĻļ āĻā§āĻā§āύāĻāĻŋ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻāĻŋāĻā§ āĻāĻāĻāĻŋ āύāϤā§āύ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻā§āĻā§āύ āĻĒā§āύāϰā§āĻĻā§āϧāĻžāϰ āĻāϰāϤ⧠āĻĻā§āϝāĻŧ āϝāĻāύ āĻāϏāϞ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻā§āĻā§āύā§āϰ āĻŽā§āϝāĻŧāĻžāĻĻ āĻļā§āώ āĻšāϝāĻŧā§ āϝāĻžāϝāĻŧāĨ¤
āĻā§āϰā§āϤā§āĻŦāĻĒā§āϰā§āĻŖ: OAuth 2.0 āĻ
āύā§āĻŽā§āĻĻāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāϤā§, āĻāĻĒāύāĻžāĻā§ Google API āĻāύāϏā§āϞ⧠āĻ
āύā§āĻŽā§āĻĻāύā§āϰ āĻļāĻāϏāĻžāĻĒāϤā§āϰāĻā§āϞāĻŋ āĻĒā§āϤ⧠āĻšāĻŦā§āĨ¤
āĻāϰ⧠āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ āĻāĻžāύāĻžāϰ āĻāύā§āϝ, OAuth 2.0 āĻ
āύā§āĻŽā§āĻĻāύ āύāĻŋāϰā§āĻĻā§āĻļāĻŋāĻāĻž āĻĻā§āĻā§āύāĨ¤
OAuth 2.0 āĻĒā§āϰāĻŦāĻžāĻš
Google APIāĻā§āϞāĻŋ āĻŦā§āĻļ āĻāϝāĻŧā§āĻāĻāĻŋ OAuth 2.0 āĻŦā§āϝāĻŦāĻšāĻžāϰā§āϰ āĻā§āώā§āϤā§āϰ⧠āϏāĻŽāϰā§āĻĨāύ āĻāϰā§:
- āϏāĻžāϰā§āĻāĻžāϰ-āϏāĻžāĻāĻĄ āĻāϝāĻŧā§āĻŦ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāĻžāύ āĻĢā§āϞ⧠āĻāϝāĻŧā§āĻŦ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻā§āϞāĻŋāĻā§ āϏāĻŽāϰā§āĻĨāύ āĻāϰ⧠āϝāĻž āύāĻŋāϰāĻžāĻĒāĻĻā§ āϏā§āĻĨāĻžāϝāĻŧā§ āϤāĻĨā§āϝ āϏāĻāϰāĻā§āώāĻŖ āĻāϰāϤ⧠āĻĒāĻžāϰā§ā§ˇ
- JavaScript āĻāϝāĻŧā§āĻŦ āĻ
ā§āϝāĻžāĻĒāϏ āĻĢā§āϞ⧠āĻāĻāĻāĻŋ āĻŦā§āϰāĻžāĻāĻāĻžāϰ⧠āĻāϞāĻŽāĻžāύ āĻāĻžāĻāĻžāϏā§āĻā§āϰāĻŋāĻĒā§āĻ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύ āϏāĻŽāϰā§āĻĨāύ āĻāϰā§āĨ¤
- āĻŽā§āĻŦāĻžāĻāϞ āĻāĻŦāĻ āĻĄā§āϏā§āĻāĻāĻĒ āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāĻžāύāĻā§āϞāĻŋ āĻāĻāĻāĻŋ āĻĄāĻŋāĻāĻžāĻāϏ⧠āĻāύāϏā§āĻāϞ āĻāϰāĻž āĻ
ā§āϝāĻžāĻĒā§āϞāĻŋāĻā§āĻļāύāĻā§āϞāĻŋāĻā§ āϏāĻŽāϰā§āĻĨāύ āĻāϰā§, āϝā§āĻŽāύ āĻāĻāĻāĻŋ āĻĢā§āύ āĻŦāĻž āĻāĻŽā§āĻĒāĻŋāĻāĻāĻžāϰ⧎
- āĻāĻŋāĻāĻŋ āĻāĻŦāĻ āϏā§āĻŽāĻŋāϤ-āĻāύāĻĒā§āĻ āĻĄāĻŋāĻāĻžāĻāϏ āĻĢā§āϞ⧠āϏā§āĻŽāĻŋāϤ āĻāύāĻĒā§āĻ āĻā§āώāĻŽāϤāĻž āϏāĻš āĻĄāĻŋāĻāĻžāĻāϏāĻā§āϞāĻŋāĻā§ āϏāĻŽāϰā§āĻĨāύ āĻāϰā§, āϝā§āĻŽāύ āĻā§āĻŽ āĻāύāϏā§āϞ āĻāĻŦāĻ āĻāĻŋāĻĄāĻŋāĻ āĻā§āϝāĻžāĻŽā§āϰāĻžāĨ¤
- āĻĒāϰāĻŋāώā§āĻŦāĻž āĻ
ā§āϝāĻžāĻāĻžāĻāύā§āĻ āĻĒā§āϰāĻŦāĻžāĻšā§āϰ āĻāύā§āϝ OAuth 2.0 āĻĢā§āϞ⧠āϏāĻžāϰā§āĻāĻžāϰ-āĻā§-āϏāĻžāϰā§āĻāĻžāϰ āĻāύā§āĻāĻžāϰāĻ
ā§āϝāĻžāĻāĻļāύ āϏāĻŽāϰā§āĻĨāύ āĻāϰ⧠āϝāĻž āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§āϰ āϤāĻĨā§āϝ āĻ
ā§āϝāĻžāĻā§āϏā§āϏ āĻāϰ⧠āύāĻžāĨ¤ āϝāĻžāĻāĻšā§āĻ, YouTube Data API āĻāĻ āĻĒā§āϰāĻŦāĻžāĻš āϏāĻŽāϰā§āĻĨāύ āĻāϰ⧠āύāĻžāĨ¤ Since there is no way to link a Service Account to a YouTube account, attempts to authorize requests with this flow will generate a
NoLinkedYouTubeAccount
error.
āĻ
āύā§āϝ āĻāĻŋāĻā§ āĻāϞā§āϞā§āĻ āύāĻž āĻāϰāĻž āĻĨāĻžāĻāϞā§, āĻāĻ āĻĒā§āώā§āĻ āĻžāϰ āĻāύā§āĻā§āύā§āĻ Creative Commons Attribution 4.0 License-āĻāϰ āĻ
āϧā§āύ⧠āĻāĻŦāĻ āĻā§āĻĄā§āϰ āύāĻŽā§āύāĻžāĻā§āϞāĻŋ Apache 2.0 License-āĻāϰ āĻ
āϧā§āύ⧠āϞāĻžāĻāϏā§āύā§āϏ āĻĒā§āϰāĻžāĻĒā§āϤāĨ¤ āĻāϰāĻ āĻāĻžāύāϤā§, Google Developers āϏāĻžāĻāĻ āύā§āϤāĻŋ āĻĻā§āĻā§āύāĨ¤ Java āĻšāϞ Oracle āĻāĻŦāĻ/āĻ
āĻĨāĻŦāĻž āϤāĻžāϰ āĻ
ā§āϝāĻžāĻĢāĻŋāϞāĻŋā§ā§āĻ āϏāĻāϏā§āĻĨāĻžāϰ āϰā§āĻāĻŋāϏā§āĻāĻžāϰā§āĻĄ āĻā§āϰā§āĻĄāĻŽāĻžāϰā§āĻāĨ¤
2024-11-17 UTC-āϤ⧠āĻļā§āώāĻŦāĻžāϰ āĻāĻĒāĻĄā§āĻ āĻāϰāĻž āĻšā§ā§āĻā§āĨ¤
[[["āϏāĻšāĻā§ āĻŦā§āĻāĻž āϝāĻžā§","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"]],["2024-11-17 UTC-āϤ⧠āĻļā§āώāĻŦāĻžāϰ āĻāĻĒāĻĄā§āĻ āĻāϰāĻž āĻšā§ā§āĻā§āĨ¤"],[[["\u003cp\u003eThe YouTube Data API uses the OAuth 2.0 protocol to authorize access to private user data, which is initiated when a user attempts to use features requiring login.\u003c/p\u003e\n"],["\u003cp\u003eDuring authorization, the application requests specific scopes of access, defining which resources it can manage on behalf of the user.\u003c/p\u003e\n"],["\u003cp\u003eUpon user consent, Google issues a token to the application, which may be exchanged for an access token and a refresh token, allowing the application to act on the user's behalf.\u003c/p\u003e\n"],["\u003cp\u003eGoogle APIs support various OAuth 2.0 flows tailored to different application types, such as server-side web apps, JavaScript web apps, mobile and desktop apps, and limited-input devices.\u003c/p\u003e\n"],["\u003cp\u003eWhile OAuth 2.0 includes a service account flow, the YouTube Data API does not support this method, and using it will result in a \u003ccode\u003eNoLinkedYouTubeAccount\u003c/code\u003e error.\u003c/p\u003e\n"]]],["The YouTube Data API uses OAuth 2.0 for user data access. Applications initiate authorization by directing users to Google, specifying the requested access scope. Upon user consent, Google provides a token. Web applications exchange this for access and refresh tokens, enabling authorized requests and token renewal. Various flows exist for different app types, including server-side web apps, JavaScript web apps, mobile/desktop apps, and limited-input devices. Service accounts are not supported for the YouTube Data API. Authorization requires credentials from the Google API Console.\n"],null,["# Implementing OAuth 2.0 Authorization\n\nThe YouTube Data API supports the [OAuth 2.0 protocol](http://oauth.net/2/) for authorizing access to private user data.\n\nThe following list explains some core OAuth 2.0 concepts:\n\n- When a user first attempts to use features in your application that requires the user to be logged in to a Google Account or YouTube account, your application initiates the OAuth 2.0 authorization process.\n\n- Your application directs the user to Google's authorization server. The link to that page specifies the **scope** of access that your application is requesting for the user's account. The **scope** specifies the resources that your application can retrieve, insert, update, or delete when acting as the authenticated user.\n\n- If the user consents to authorize your application to access those resources, Google returns a token to your application. Depending on your application's type, it either validates the token or exchanges it for a different type of token.\n\n For example, a server-side web application exchanges the returned token for an access token and a refresh token. The access token lets the application authorize requests on the user's behalf, and the refresh token lets the application retrieve a new access token when the original access token expires.\n\n**Important:** To use the OAuth 2.0 Authorization, you need to [obtain authorization credentials in the Google API Console](/youtube/registering_an_application).\n\nFor more details, see the [OAuth 2.0 Authorization Guide](https://developers.google.com/identity/protocols/oauth2).\n\nOAuth 2.0 flows\n---------------\n\nGoogle APIs support several OAuth 2.0 use cases:\n\n- The [server-side web apps](/youtube/v3/guides/auth/server-side-web-apps) flow supports web applications that can securely store persistent information.\n- The [JavaScript web apps](/youtube/v3/guides/auth/client-side-web-apps) flow supports JavaScript applications running in a browser.\n- The [mobile and desktop apps](/youtube/v3/guides/auth/installed-apps) flow supports applications installed on a device, such as a phone or computer.\n- The [TVs and limited-input devices](/youtube/v3/guides/auth/devices) flow supports devices with limited input capabilities, such as game consoles and video cameras.\n- The OAuth 2.0 flow for service account flow supports server-to-server interactions that do not access user information. However, the YouTube Data API does not support this flow. Since there is no way to link a Service Account to a YouTube account, attempts to authorize requests with this flow will generate a `NoLinkedYouTubeAccount` error."]]