我需要在getAuthToken过期后刷新它。我将getAuthToken调用放在background.js中,并将变量保存在存储器中,以便内容脚本可以接收它。到目前一切尚好。当令牌正确过期时,我从google drive API接收到401码,然后我从内容脚本向background.js发送一条消息,以便使用removeCachedAuthToken,然后我重做getAuthToken调用,并返回到存储器中的令牌。所有这些都是有效的,用户重新加载页面,使扩展保持打开状态,以将消息从内容脚本传递到background.js,并再次重新加载内容脚本,接收令牌以进行google drive ap
我正在用Node.js和Express制作API。
此外,我还为auth用户使用了JWT令牌身份验证。
如果令牌过期,我的场景就在这里。
(Backend) Middleware detect expired
(Frontend) Receive token is expired
(Fronend) Refresh token request to backend
(Backend) Verify token is valid and if it expired, sign new token(with old token's payload) and response
当我试图在我的程序中使用jxcore.tasks.addTask函数时,我得到了这个错误。
undefined:1
function (){}
^
SyntaxError: Unexpected token u
at Object.parse (native)
at gcc (_jx_tasks.js:130:24)
at process.<anonymous> (_jx_tasks.js:425:3)
at process.emit (events.js:106:17)
at process.__makeCall (node.js:420
我正在为我的SPA使用django-rest框架-jwt和react。
需要在5分钟内过期的刷新令牌。刷新在5分钟内有效。无法工作后,控制台将显示以下错误:
POST http://localhost:8000/auth/api-token-refresh/ 400 (Bad Request)
createError.js:17 Uncaught (in promise) Error: Request failed with status code 400
at createError (createError.js:17)
at settle (settle.js:19)
我创建了刷新令牌来使用YouTube验证我的Python,并将其保存在我的系统上以备将来使用。但一周后,我发现即使是刷新令牌也过期了,我必须再次使用OAuth同意屏幕对应用程序进行身份验证。是否有方法绕过此刷新令牌过期限制,以便无需任何进一步身份验证即可调用API?
if os.path.exists(self.token):
print('Loading Credentials From File...')
with open(self.token, 'rb') as token:
self.creden