Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to refresh an access token for the youtube-data-api v3

$
0
0

I'm using v3 of the youtube data api for my server.So far I'm able to create a token by getting a code from the redirect.

                oauth2Client.getToken(req.query.code, function(err, token) {                    if (err) {                      console.log('Error while trying to retrieve access token', err);                      return;                    }                    oauth2Client.credentials = token;                    storeToken(token);                    res.redirect("/channel");                  });

I'm storing this token locally, but I have a couple questions on the following;

  1. How do I check if this token is valid when a request is about to be made?
  2. How do I get a new token by using the refresh token if the token I currently have is expired?

Viewing all articles
Browse latest Browse all 3831

Trending Articles