# Android app is reporting as logged in when authentication fails, and Failed token exchange

**URL:** <https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [May 19, 2026, 7:07pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096 "2026-05-19T19:07:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![techadmin2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/techadmin2/32/50714_2.png) [@techadmin2](https://community.auth0.com/u/techadmin2)\
**Post date:** [May 19, 2026, 7:07pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096/1 "2026-05-19T19:07:01Z")

</div>

Hi!

I have multiple tenants in production for different regions. We’ve noticed Android in the UK has started failing for some users. The credential token fails to authenticate when we verify it on our BackEnd.

I’m also seeing some odd errors in the log, that, I believe, are related.

```  
{  
“date”: “2026-05-19T04:26:33.389Z”,  
“type”: “fertft”,  
“description”: “Token could not be decoded or is missing in DB”,  
“connection\_id”: “”,  
“client\_id”: “”,  
“client\_name”: “”,  
“ip”: “”,  
“client\_ip”: “”,  
“user\_agent”: “okhttp 4.12.0 / Other 0.0.0”,  
“details”: {  
“policy\_used”: null  
},  
“hostname”: “”,  
“user\_id”: “”,  
“user\_name”: “”,  
“audience”: null,  
“scope”: null,  
“auth0\_client”: {  
“name”: “Auth0.Android”,  
“env”: {  
“android”: “30”  
},  
“version”: “3.8.0”  
},  
“location\_info”: {  
“latitude”: ,  
“longitude”: ,  
“country\_code”: “”,  
“country\_name”: “”,  
“city\_name”: “”,  
“subdivision\_code”: “”,  
“subdivision\_name”: “”,  
“continent\_code”: “NA”,  
“time\_zone”: “America/New\_York”,  
“country\_code3”: “USA”  
},  
“$event\_schema”: {  
“version”: “1.0.0”  
},  
“environment\_name”: “prod-uk-1”,  
“log\_id”: “90020260519042633438927000000000000001223372042014800925”,  
“tenant\_name”: “”,  
“\_id”: “90020260519042633438927000000000000001223372042014800925”,  
“isMobile”: false,  
“id”: “90020260519042633438927000000000000001223372042014800925”  
}  
```  
I’m unsure where to troubelshoot.

I’ve seen past solutions around making sure the application is marked as native, and it is.

this also seems to be limted to android. (Given that it’s only ever using the okhttp library, which is the kotlin/android networking library.)

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 19, 2026, 10:31pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096/3 "2026-05-19T22:31:29Z")

</div>

Hi @techadmin2

Welcome back to the Auth0 Community!

The `fertft` error code stands for **Failed Exchange of Refresh Token for Access Token**. The specific description `"Token could not be decoded or is missing in DB"` almost always indicates that Auth0’s security mechanisms proactively wiped the user’s Refresh Token family from the database due to a perceived **Refresh Token Reuse**. On Android, this is most commonly caused by network-level retries occurring on spotty mobile connections.

When you have **Refresh Token Rotation** enabled, every time the Android app uses a Refresh Token to get a new Access Token, Auth0 issues a _new_ Refresh Token and invalidates the old one.

If Auth0 receives the _same_ Refresh Token twice, it assumes a malicious replay attack is occurring. To protect the user, Auth0 immediately revokes the entire token family. Any subsequent attempts by the app to use that token will result in the exact error you are seeing: the token is “missing in the DB”.

Given this is limited to Android and localized to a specific geographic region, here are the most likely sequence of events:

1. A user in the UK on a spotty mobile data connection attempts to open the app, triggering a token refresh.
2. The request successfully reaches your Auth0 UK tenant. Auth0 generates the new tokens, updates the database, and sends the HTTP response back.
3. The network connection drops _before_ the Android device receives the response. Because the Android networking library often has silent connection retries enabled by default, or the app’s internal logic attempts a retry, it fires the _exact same request_ containing the old Refresh Token.
4. Auth0 receives the old token, flags it as “Reused,” and immediately deletes the token family from the database.
5. The next time the app tries to refresh, you get the `fertft` log.

Because the token family has been completely destroyed on the backend, this state is unrecoverable for the affected session. The token cannot be “fixed.”

To resolve this, you must implement a robust catch-and-recover mechanism in your Android codebase. You must ensure your Android application catches the specific authentication exception and routes the user back to the Universal Login screen. If you are using the `CredentialsManager` in the `Auth0.Android` SDK, it should look like this:

```auto
credentialsManager.getCredentials(object : Callback<Credentials, CredentialsManagerException> {
    override fun onSuccess(credentials: Credentials) {
    }

    override fun onFailure(error: CredentialsManagerException) {
        if (error.isInvalidRefreshToken) {
            credentialsManager.clearCredentials()
            loginUser() 
        }
    }
})

```

Ensure you are relying strictly on the thread-safe `CredentialsManager.getCredentials()` method to fetch your tokens before API calls. Do not manually extract the Refresh Token and attempt to hit the `/oauth/token` endpoint yourself, as managing the concurrency to prevent race conditions across Android coroutines/threads is highly error-prone.

If you have any other questions, please let me know!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![techadmin2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/techadmin2/32/50714_2.png) [@techadmin2](https://community.auth0.com/u/techadmin2)\
**Post date:** [May 20, 2026, 1:45pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096/4 "2026-05-20T13:45:52Z")

</div>

Thanks for the help, I believe we already are taking your recommended steps.

What this doesn’t explain is why this is regional?

EDIT:

The code in question

```auto
    override fun isUserLoggedIn(): Boolean {
        val auth0 = getAuth0APIForRegion() ?: return false
        val credentialsManager = SecureCredentialsManager(
            context = ctx,
            auth0 = auth0,
            storage = SharedPreferencesStorage(ctx)
        )
        return credentialsManager.hasValidCredentials()
    }

```

This is run at app startup, and is reporting true, and when we then get the auth token with the following:

```auto
    override suspend fun getAuthToken(): String {
        val auth0 = getAuth0APIForRegion() ?: return ""
        val credentialsManager = SecureCredentialsManager(
            context = ctx,
            auth0 = auth0,
            storage = SharedPreferencesStorage(ctx)
        )
        return suspendCoroutine { cont ->
            credentialsManager.getCredentials(object :
                Callback<Credentials, CredentialsManagerException> {
                override fun onFailure(error: CredentialsManagerException) {
                    Sentry.captureException(error)
                    cont.resume("")
                }

                override fun onSuccess(result: Credentials) {
                    cont.resume(result.accessToken)
                }
            })
        }
    }

```

Sentry is not reporting errors here.

So we are indeed already logging the recommendations above, and are not seeing errors. until the API is actually called.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 20, 2026, 7:44pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096/5 "2026-05-20T19:44:43Z")

</div>

Thanks for providing more context regarding the **Failed Exchange of Refresh Token for Access Token** (fertft) issue that you are experiencing.

From analyzing the code that you have sent, I believe that the root cause of the `fertft` (Refresh Token Reuse) error is that **`SecureCredentialsManager` is being instantiated repeatedly inside your functions instead of being used as a Singleton.**

By creating a new instance of `SecureCredentialsManager` every time `getAuthToken()` is called, you are bypassing the SDK’s built-in thread-safety mechanisms. This allows multiple concurrent API calls at app startup to fire multiple token refresh requests to Auth0 simultaneously using the exact same Refresh Token, triggering the security revocation.

The reason why this could be only a regional issue with you current implementation is that race conditions are hyper-sensitive to network latency and timing jitter.  
If your UK users are connecting to a newly provisioned UK tenant, the geographical routing, DNS resolution times, and API response latencies are different than your US or EU tenants. If the UK network latency aligns perfectly with the time it takes your Android coroutines to dispatch those concurrent API calls, the race condition will trigger flawlessly. It does not appear to be a bug in the UK tenant; the UK network conditions are just the perfect storm for this race condition to manifest.

In order to attempt to fix this issue, you must ensure that `SecureCredentialsManager` is a **Singleton** across the entire lifecycle of your application:

1. **Refactor using Dependency Injection (e.g., Hilt/Dagger):**  
If you use DI, provide the `SecureCredentialsManager` as a `@Singleton` .

2. **Refactor using a Kotlin Object / Lazy initialization:** If you aren’t using DI, initialize it once globally:

```auto
object AuthManager {
    private var credentialsManager: SecureCredentialsManager? = null

    fun getManager(context: Context): SecureCredentialsManager {
        if (credentialsManager == null) {
            val auth0 = getAuth0APIForRegion() // Ensure this returns correctly
            credentialsManager = SecureCredentialsManager(
                context,
                auth0,
                SharedPreferencesStorage(context)
            )
        }
        return credentialsManager!!
    }
}

```

1. Then update your methods to use the shared instance:

```auto
override suspend fun getAuthToken(): String {
    val manager = AuthManager.getManager(ctx)
    
    return suspendCoroutine { cont ->
        manager.getCredentials(object : Callback<Credentials, CredentialsManagerException> {
            override fun onSuccess(result: Credentials) {
                cont.resume(result.accessToken)
            }
            override fun onFailure(error: CredentialsManagerException) {
                Sentry.captureException(error)
                cont.resume("")
            }
        })
    }
}

```

Looking forward to your next reply regarding if the provided solution to the matter resolved the issue or not.

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![herman54](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/herman54/32/78544_2.png) [@herman54](https://community.auth0.com/u/herman54)\
**Post date:** [July 16, 2026, 5:49pm UTC](https://community.auth0.com/t/android-app-is-reporting-as-logged-in-when-authentication-fails-and-failed-token-exchange/200096/7 "2026-07-16T17:49:08Z")

</div>

It is more like an authentication/token issue than a networking problem. The Failed token exchange and Token could not be decoded or is missing in DB errors usually mean the refresh token or authorization code is no longer valid when your backend tries to exchange or verify it. Since its only affecting Android users, start by checking the Auth0.Android SDK version, token storage, device time synchronization, and whether the affected users are all using the same app build. Also verify your callback URLs and that the Android app is still registered as a Native application. If users appear “[`logged in`](https://speedport-ips.de/192-168-i78-1-login/)” while your backend rejects the token, there may be a mismatch between the local session state and the actual token validation. Enabling verbose Auth0 logs and capturing a failing authentication flow from one affected device should help narrow it down. If the issue only happens in one region, its also worth checking whether any proxy, VPN, or network configuration is interfering with the token exchange. 😙
