Skip to content

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

@LA-Johan

Description

@LA-Johan

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 { getCredentials } = useAuth0()
  const backend = axios.create({ baseURL: apiUri, timeout: 10000 })
  backend.interceptors.request.use(
    async config => {
      const credentials = await getCredentials()
      config.headers["Authorization"] = `Bearer ${credentials?.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:
90020251110035154104236000000000000001223372093331920555

Our top level provider:

<Auth0Provider domain={domain} clientId={clientId}>
      <Main />
</Auth0Provider>

Reproduction

Seems to happen randomly, a few times a week for affected users. So far we've only seen it on iOS.

Additional context

A similar issue happens when we use the react version, for both MacOS, iOS, and Windows 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.

react-native-auth0 version

5.1.0

React Native version

0.81.4

Expo version

Not using expo

Platform

iOS

Platform version(s)

Multiple

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions