Is this a bug or did YouTube remove access?

585 Views Asked by At

We have built an app that asks for access to the YouTube API. We are not authorized yet, but are using it with our own accounts. We have the following problem: While some of our Gmail accounts grant us access, some others fail even though on their third party security settings, you can see that they have granted us access. It seems that they have removed us from their lists, even though they haven't and we know that since these are our accounts.

  1. Has anyone seen something like that?
  2. Is getting our app authorized going to solve this?
  3. Is there any other solution that you could offer?

Thanks for taking the time

my error message

status code: 400, response { data: { error: 'invalid_grant', error_description: 'Token has been expired or revoked.' } } }

1

There are 1 best solutions below

0
Linda Lawton - DaImTo On

Token has been expired or revoked.

Normally means that the refresh token you are using is no longer valid and you need to reauthenticate your user. The easiest way to test if i am right is to do just that force a reauth on the user.

causes for refresh token experation.

Refresh tokens while long lived they can expire for several reasons.

  1. The user goes into their google account and revokes your applications access.
  2. The refresh token hasn't been used in a while normally 3 -6 months google will automatically expire it.
  3. You have reached the maximum number of outstanding refresh tokens for a user the oldest one will be expired.
  4. It can also be related to the time on your system being out of sync with NTP (note i havent seen this error in years)

Let me try and explain number three a bit more. When a user authenticates your application you are given a refresh token. When the user authenticates your application again you are given an other refresh token. Both tokens will work as expected. You can continue this until you have up to 50 outstanding refresh tokens once you hit number 50 the first and oldest one will be expired. This is why it is important to always save new refresh tokens over the old one.