I don't know if there is a problem with my code but; using google-apis nodejs client for Drive REST API.
However, when I refresh my access token with the refresh token provided, it gives me an expiry time as seconds. (3600 more seconds from request)
I store them in a text file. Then I set credentials before a new request.
oauth2Client.setCredentials({
access_token: gTokens[0],
refresh_token: gTokens[1],
expiry_date: gTokens[2]
});
var expiryDate = oauth2Client.credentials.expiry_date;
var isTokenExpired = expiryDate ? expiryDate <= (new Date()).getTime() : false;
Then I check wheter access token is expired or not. The code above gives me true for isTokenExpired. Even If my access token is expired, I can upload a file to Google Drive with an access token which is expired long time ago.
What's the problem?