Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Users getting logged out with "Unsuccessful Refresh Token exchange, reused refresh token detected"

未关闭
#929 18 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
活跃
技术栈
react, typescript

调研方向

从 auth0-react Sample-01 应用开始,检查报告中描述的 Auth0Provider 配置和 getAccessTokenSilently 的使用。跟踪启用 cacheLocation="localstorage" 和 useRefreshTokens 时的刷新令牌处理,并在可能的情况下复现间歇性交换失败。完成的标准是确定因重复使用令牌而登出的原因,并在报告涉及的环境中验证受影响的行为。

由索引模型根据 Issue 内容生成。

描述

bug
Checklist
Description

Our usage of Auth0 is pretty simple. After the user has been logged in we just attach the access token to network calls and verify them server side.

const useApi = (): Api => {
  const { getAccessTokenSilently } = useAuth0()
  const backend = axios.create({ baseURL: apiUri, timeout: 10000 })
  backend.interceptors.request.use(
    async config => {
      const accessToken = await getAccessTokenSilently()
      config.headers["Authorization"] = `Bearer ${accessToken}`
      return config
    },

    async error => {}
  )
}  

We have gotten user reports that they get error in title. Our understanding is that this error is unrecoverable so we log the user out and force them to re-authenticate. We have a couple of thousand weekly users and this happens to maybe 2% of them.

One log id as an example:
90020251109193144192993000000000000001223372093304300940

Our top level provider:

 <Auth0Provider
        key={`${domain}-${clientId}-${audience}`} // This forces remount when values change
        domain={domain}
        clientId={clientId}
        authorizationParams={{
          redirect_uri: getFrontEndHost(),
          audience: audience,
        }}
        cacheLocation={"localstorage"}
        onRedirectCallback={onAuth0Redirect}
        useRefreshTokens={true}
      >
        <AppWithTheme />
</Auth0Provider>
Reproduction

Seems to happen randomly, a few times a week for affected users. Mostly on iOS and MacOS devices but we've also seen it happen on Windows machines.

Additional context

A similar issue happens when we use the react native version, but only for iOS devices. We allow overlap for expiring refresh tokens (120 seconds). Our refresh token are set to last one year, and we're currently seeing this multiple times a week for users.

auth0-react version

2.8.0

React version

19.1.0

Which browsers have you tested in?

Chrome, Safari

主要语言
TypeScript
星标
991
派生
294
平均合并
11 小时 1 分钟
30 天内合并 PR
51

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

auth0/auth0-react 的其他 Issue

查看 auth0/auth0-react 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。