Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Persistent OAuth Authorization for YouTube API Automation Needed

Hi there,

I’ve been trying to automate updates to my YouTube video descriptions, titles, etc., whenever a new video is uploaded. The setup relies on the refresh token and access token, but the refresh token becomes invalid after a week since I’m using OAuth Playground, which was only intended for testing. I need a more stable solution—something I can set up once that will consistently work without needing frequent reauthorization. I attempted to use the Client ID and Client Secret defined through OAuth Playground, but it doesn’t prevent the refresh token from expiring weekly. This isn’t for an app; it’s just a simple automation for my YouTube channel. I’m looking for the easiest way to avoid this issue.

Solved Solved
0 2 843
1 ACCEPTED SOLUTION

Hi @JPres,

I understand that you're looking forward to extending the lifespan of the refresh token while your setup is currently pointing to "testing".

Currently, it's an intended behavior for the refresh token to always have a lifespan for as long as 7 days. This will remain intact as long as the publishing status is set to "Testing".

You have an option to customize your project in such a way that it supports multiple unexpired access and refresh tokens. This can avoid user disruption and lessen the complex timing and error handling scenarios. Note that there is a limit of 100 refresh tokens per Google Account per OAuth 2.0 client ID. This is based on the official guidelines concerning refresh tokens which you can read more about here.

With this, the obvious solution here would be to publish the OAuth consent screen app.

I hope the above information is helpful.

View solution in original post

2 REPLIES 2

Hi @JPres,

I understand that you're looking forward to extending the lifespan of the refresh token while your setup is currently pointing to "testing".

Currently, it's an intended behavior for the refresh token to always have a lifespan for as long as 7 days. This will remain intact as long as the publishing status is set to "Testing".

You have an option to customize your project in such a way that it supports multiple unexpired access and refresh tokens. This can avoid user disruption and lessen the complex timing and error handling scenarios. Note that there is a limit of 100 refresh tokens per Google Account per OAuth 2.0 client ID. This is based on the official guidelines concerning refresh tokens which you can read more about here.

With this, the obvious solution here would be to publish the OAuth consent screen app.

I hope the above information is helpful.

"You have an option to customize your project in such a way that it supports multiple unexpired access and refresh tokens."

Hi KyleMari. Thanks a lot. Could you maybe elaborate on that. How I can achieve that. So setting the project active and then gathering the refresh token that actually does not have a lifespan.