gpt4 book ai didi

javascript - chrome.identity.getAuthToken 和刷新 token ?

转载 作者:行者123 更新时间:2023-11-29 14:47:40 26 4
gpt4 key购买 nike

我的印象是在使用 chrome.identity.getAuthToken 和 gapi.auth.authorize({immediate: true...}); token 将在后台刷新。

但它显然没有......在 40-50 分钟后 GMail token 过期,使用缓存的 token 但返回 401,正如人们所期望的那样。

是否可以使用 chrome.identity.getAuthToken 接收刷新 token (我知道它只会在第一次接收访问 token 时出现)?回调中似乎只返回token字符串。

紧接着上面的问题,我可以检索experation时间来检查何时重新生成访问 token 吗?

整个 Oauth 2 仍然比我预期的要难。

最佳答案

很确定对 401 的预期响应是撤销授权 token ,然后请求另一个 token 。

https://developer.chrome.com/apps/identity#method-removeCachedAuthToken

chrome.identity.removeCachedAuthToken({token: }, 回调函数)

关于javascript - chrome.identity.getAuthToken 和刷新 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30705306/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com