YouTube에서 Shorts 동영상의 조회수를 집계하는 방식에 맞게 Data API를 업데이트하고 있습니다.
자세히 알아보기
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 Console에서 승인 사용자 인증 정보를 가져와야 합니다.
자세한 내용은 OAuth 2.0 승인 가이드를 참고하세요.
OAuth 2.0 흐름
Google API는 다음과 같은 여러 OAuth 2.0 사용 사례를 지원합니다.
- 서버 측 웹 앱 흐름은 영구적인 정보를 안전하게 저장할 수 있는 웹 애플리케이션을 지원합니다.
- JavaScript 웹 앱 흐름은 브라우저에서 실행되는 JavaScript 애플리케이션을 지원합니다.
- 모바일 및 데스크톱 앱 흐름은 휴대전화나 컴퓨터와 같은 기기에 설치된 애플리케이션을 지원합니다.
- TV 및 입력 제한 기기 흐름은 게임 콘솔, 동영상 카메라와 같이 입력 기능이 제한된 기기를 지원합니다.
- 서비스 계정 흐름의 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 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-11-05(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-05(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."]]