Refresh token of google api do not work properly in nodejs

后端 未结 2 1850
死守一世寂寞
死守一世寂寞 2021-01-03 03:21

I am using google api nodejs , I try to get data from google Anaytics

var google = require(\'googleapis\');
var OAuth2Client = google.auth.OAuth2;
var CLIENT         


        
2条回答
  •  感动是毒
    2021-01-03 04:02

    access_token have expire time is 1 hour. You must refresh access_token when it's expired.

    oauth2Client.refreshAccessToken(function(err, tokens) {
      // your access_token is now refreshed and stored in oauth2Client
      // store these new tokens in a safe place (e.g. database)
    });
    

    Can you find it here

提交回复
热议问题