owncloud / owncloud/android

[BUG] Refresh token is not updated after re-authentication with OIDC, causing repeated token expiration errors

Open
#4,610 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

Hello,

I’m using the Android OwnCloud app with a self-hosted OwnCloud server configured for OIDC authentication via Authelia. When the refresh token expires, the app correctly prompts for re-authentication, which succeeds. However, after this successful login, the app continues to send the old expired refresh token to the server, causing the server to reject it and the login to fail repeatedly.
The only workaround I found is to completely clear the app’s data on Android, which resets the tokens and allows a fresh authentication flow.
It appears that the app is not properly updating or replacing the stored refresh token after re-authentication, resulting in the use of stale tokens.
Steps to reproduce:

  1. Authenticate with OIDC via the app.
  2. Let the refresh token expire.
  3. Attempt to refresh the token → app prompts for login.
  4. Login succeeds, but app continues to send the expired refresh token.
  5. Server rejects the token and access fails.
    Expected behavior:
    After a successful re-authentication, the app should update the stored refresh token with the new one provided by the server and use it for subsequent token refreshes.
    Additional information:
    • Android OwnCloud app version: v4.5.1
    • OwnCloud server version: v10.15.2
    • OIDC provider: Authelia
    • Clearing app data fixes the issue temporarily

This issue causes a poor user experience and requires manual intervention to resolve.

Thank you for looking into this!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the expired-refresh-token flow described in the issue on Android with OIDC, then trace the re-authentication entry point and stored token handling. Verify whether the successful login returns a replacement refresh token and where it is persisted. Done means subsequent refreshes use the new token without requiring app-data clearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.