YouTube API and brand account

2019-03-31 12:03发布

问题:

I am using, since a long time, a Google script that accesses my YouTube channel, gets and modifies some information from it and saves some data in a Google sheet.

It always worked fine, but then, about a week ago, Google somehow split my access rights between my normal account (primary email) and my YouTube account (that goes under a different nickname).

I cannot find a way to run even the simplest command:

var my_playlists = YouTube.Playlists.list('snippet', {
    mine: true,
    maxResults: 50,
})
.items; 

The problem is that google now prompts me with an authorization page and I can choose between 2 accounts. One is my primary account, the other is the YouTube one. If I choose my primary account, the code runs but I cannot see the data of the YouTube account.

If I choose the YouTube one, I still cannot access the data I want and it keeps asking for permission every time I run the code.

I understand there is a problem of authorization between the two channels, but I did not have it before and cannot find any suggestion to solve it.

What can I resolve this problem?

回答1:

I've been struggling with the exact same issue but for another cause. Anyways, so far I can manipulate anything I want within my PERSONAL youtube account, granting access using OAuth to MY ACCOUNT, but if grant access to my branded account, the script doesn't even begin, apparently it's a bug that causes loop in the script.

You can check this out for more info:

  • YouTube Apps Script API only runnable by accounts without a YouTube channel?
  • https://issuetracker.google.com/issues/36764531
  • https://mashe.hawksey.info/2017/09/identity-crisis-using-the-youtube-api-with-google-apps-script-and-scheduling-live-broadcasts-from-google-sheets/
  • Using Youtube Data API to Edit with Brand Account Playlist