我正在使用 twitter API 让用户使用离线范围登录,并在过期时尝试刷新他们的令牌以保持对他们的 oauth 的访问。
但有时 twitter API 会随机抛出以下错误:
TwitterResponseError: ... {
status: 401,
statusText: 'Unauthorized',
headers: {
'cache-control': 'no-cache, no-store, max-age=0',
connection: 'close',
'content-length': '99',
'content-type': 'application/problem+json',
date: 'Sat, 01 Apr 2023 23:22:04 GMT',
perf: '7626143928',
server: 'tsa_b',
'x-connection-hash': '868ff5ec7376e3814861c6dcaebd3c6daa32496a175a41aceb426bda0f7b54b8',
'x-response-time': '4',
'x-transaction-id': 'b7c7ef409b154dde'
},
error: {
title: 'Unauthorized',
type: 'about:blank',
status: 401,
detail: 'Unauthorized'
}
我环顾四周,但找不到任何解决方案。而且我确定用户没有撤销他们的 OAuth。
任何帮助将不胜感激。
不知道是不是巧合,这个错误是从3月24日开始出现的
今天早上我的 Twitter API 开始出现同样的错误 401,所以我很想听听任何答案。