3

I'm calling the below end point

https://youtubeanalytics.googleapis.com/v2/reports?

The API was working fine till yesterday.

I linked a new YouTube account to fetch data using the API and I'm getting 403 forbidden error.

I have 2 accessTokens, one which was linked 2 weeks ago, it works fine. But the new accessToken throws 403 forbidden error.

I have checked the scope as well. It's the same while fetching the news accessToken.

How do I fix this?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Anirudh
  • 2,767
  • 5
  • 69
  • 119
  • 1
    Can you please add the code you're using? It helps to know the class and package you're using and how you're managing the URL and header of the request. – André Mar 26 '19 at 22:53

1 Answers1

6

403 forbidden error.

Means that you dont have access to do what you are trying to do. You are trying to access an API endpoint that you dont have access to. Remember YouTube APIs are channel based. This means that you authorize per channel the access.

If you have five YouTube channels and want to see the analytics for each of these channels you will need to authenticate five times and get five different refresh tokens. Each token will only give you access to one channel.

Your issue could be that you are trying to access a channel with an in correct access token.

Timeout

Access tokens expire after one hour you will need to request a new one. If you have requested a refresh token then you can use a refresh token to request a new access token. Remember not to mix them up a refresh token will only give you an access token to access the single account. You will need one for each account you are trying to access.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449