我们如何延长Google API访问令牌的期限?

问题描述

代码

这是我们的代码

const auth = new google.auth.GoogleAuth({
  keyFile: '/path/to/key.json',scopes: ['https://www.googleapis.com/auth/analytics.readonly'],})
...
var accesstoken = await auth.getAccesstoken()
  .catch(error => {
    console.error(error)

    return null
  })

故障

令牌在30分钟内失效。

我们希望生成至少在2天后失效的令牌。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)