"403 Forbidden" with Youtube Analytics API using service account

Hi everyone !

I'm currently trying to get a Youtube Analytics API to work to retrieve video metrics from my Youtube channel, I'm doing this using Postman to send HTTPS requests.

There is my request :

Benot_0-1662560939258.png

And in headers i just have the "Authorization" with "Bearer (my access token)" as value

It works fine with classic Oauth2 authentication (give the secret id and client id to receive the access token). But it requires human intervention to authenticate which I would like to avoid, so I decided to do this using a service account. I created one (I am the only user and so have the owner statut on it) and managed to generate a access token from the JWT, but when I use this token in the Youtube Analytics API request just above, I get a "403 Forbidden" error that I don't really understand.

Youtube Analytics API is enabled on my Google Cloud Console, I can see the service account in the list of compatible credentials. I use the same scope for JWT as for classic authentication "https://www.googleapis.com/auth/yt-analytics.readonly". I really don't understand why I have this authorization error with the service account token when the classic Oauth2 token works next, do you have a idea of the reason ?

Thanks in advance for the help !

0 2 1,344
2 REPLIES 2

According to this information, there is no way to link a Service Account to a YouTube account, attempts to authorize requests with this flow will generate an error. You may also be interested to follow this issue tracker.

Yeah Tori keep ur ass off my phone software you and all ur friends fr

Top Labels in this Space