Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google / Youtube Oauth2.0 #31

Open
lmquang opened this issue Jul 25, 2024 · 0 comments
Open

Google / Youtube Oauth2.0 #31

lmquang opened this issue Jul 25, 2024 · 0 comments

Comments

@lmquang
Copy link
Owner

lmquang commented Jul 25, 2024

Google / YouTube Authentication using a Brand Account

Below describes the only way I was able to get (programmatic) access to the YouTube Analytics API on behalf of our Brand Account.
Google documentation is convoluted, to say the least, so if you know a more straightforward way, please do share.

Getting a Client ID and Refresh Token

  1. Create a Project in the Developers Console - https://console.developers.google.com/
  2. Go to the Library tab and enable desired APIs (e.g. YouTube Analytics)
  3. Go to OAuth consent screen and make project external. Select Test mode
  4. Go to Credentials and create OAtuh Client ID credential: Application type = web; redirect uri = https://developers.google.com/oauthplayground
  5. Go to https://developers.google.com/oauthplayground
  6. Select gear icon -> Access type = Offline, Force prompt = Select Account Screen, Use your own OAuth credentials = checked --> enter client id and client secret from step 4
  7. Click Select & authorize API's and select the desired APIs (e.g. https://www.googleapis.com/auth/youtube.readonly , https://www.googleapis.com/auth/youtubepartner , https://www.googleapis.com/auth/yt-analytics-monetary.readonly and https://www.googleapis.com/auth/yt-analytics.readonly
  8. Click 'Authorize APIs'
  9. In the consent screen, first select your Google account, then in the next screen select your brand account
  10. Back in the OAuth Playground, you received an Authorization Code. Click Exchange authorization code for tokens
  11. Copy the Refresh token
  12. Go back to your project in the Developers Console and change the User type to internal by clicking the Make internal button
  13. Download your Client ID json from the Developers Console: Credentials -> OAuth 2.0 Client IDs table -> Click the download icon next to your Client Id (in the far right of that row)

source: https://gist.github.com/veuncent/e0b831ab41d598961d2656c7fc5cc0f9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant