Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Token Refreshing of YouTube doesn't work #212

@hlxid

Description

@hlxid

Description

The automatic token refreshing of the YouTube service doesn't work. The service works while the access token is valid. Once it is invalid because it didn't get refreshed and you do anything with the service it will create an error that no refresh token was provided.

As we are at YouTube auth anyway we can also implement saving of the tokens to the config.

How to reproduce

  1. Create a youtube service
  2. Wait for the access token to invalidade
  3. Do any API call

Error Log

UNHANDLED PROMISE REJECTION!
Error: No refresh token is set.
    at OAuth2Client.refreshTokenNoCache (/home/pi/nodecg-io/node_modules/google-auth-library/build/src/auth/oauth2client.js:162:19)
    at OAuth2Client.refreshToken (/home/pi/nodecg-io/node_modules/google-auth-library/build/src/auth/oauth2client.js:143:25)
    at OAuth2Client.getRequestMetadataAsync (/home/pi/nodecg-io/node_modules/google-auth-library/build/src/auth/oauth2client.js:259:28)
    at OAuth2Client.requestAsync (/home/pi/nodecg-io/node_modules/google-auth-library/build/src/auth/oauth2client.js:332:34)
    at OAuth2Client.request (/home/pi/nodecg-io/node_modules/google-auth-library/build/src/auth/oauth2client.js:326:25)
    at createAPIRequestAsync (/home/pi/nodecg-io/node_modules/googleapis-common/build/src/apirequest.js:273:31)
    at Object.createAPIRequest (/home/pi/nodecg-io/node_modules/googleapis-common/build/src/apirequest.js:53:16)
    at Resource$Playlists.list (/home/pi/nodecg-io/node_modules/googleapis/build/src/apis/youtube/v3.js:1815:44)
    at Timeout._onTimeout (/home/pi/nodecg-io/samples/youtube-playlist/extension/index.js:11:49)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

References

Bug report on discord

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserviceRequires changes to a service

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions