You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Refresh token is not updated after re-authentication with OIDC, causing repeated token expiration errors #4610
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:
Authenticate with OIDC via the app.
Let the refresh token expire.
Attempt to refresh the token → app prompts for login.
Login succeeds, but app continues to send the expired refresh token.
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.
that will be available in 4.6.0 version, expected July. In advance, i will provide you a testing apk including the fixes, so that you can check if your problem is also fixed. Here it is:
You mean, the app i shared with you? Within the current week, we'll release a new version with latest changes. If the problem persists, we can provide you a safe place in which you could share credentials of your server with us (if you wish), so that we could test with your server instance directly.
Hi @restonica! We have just released a new version (4.6.1), now available on the Play Store! This release includes a potential bugfix for re-login when credentials expire. Could you check it? Let us know if the problem persists 🤔
Likely already fixed in 4.7.0 (current release: 4.8.2) — needs a retest.
Verified against current master, the token-refresh persistence path looks correct, so the symptom is not a stale-token storage bug:
Silent refresh persists the rotated refresh token: AccountAuthenticator.javahandleSuccessfulRefreshToken() writes KEY_OAUTH2_REFRESH_TOKEN on every successful refresh (falls back to the old one only if the IdP returns none).
Re-auth persists the new token too: OCLocalAuthenticationDataSource.addOAuthAccount() overwrites KEY_OAUTH2_REFRESH_TOKEN for the updated account.
The Authelia-specific failure looks like the token request, not token storage. #4575 (same setup: OIDC + Authelia, re-auth fails right after a successful login) was fixed in 4.7.0 by #4671 — the token request now sends client_secret_post / the authorization header only when the IdP's token_endpoint_auth_methods_supported calls for it. Authelia commonly uses client_secret_post, which older builds handled wrong.
Timeline note: your last confirmed test was 4.6.0. 4.6.1 (#4654) only changed the re-login startActivity flow — not the Authelia auth-method fix, which landed later in 4.7.0.
Please retest on the latest Play Store build (4.8.2) and report back. If it still fails there, capture the token-request/response (client auth method + error) so we can pin the exact cause.
Activity
jesmrec commentedon Jun 23, 2025
Hi @restonica! about the described problem, we have fixed the following issues recently:
#4332
#4080
that will be available in 4.6.0 version, expected July. In advance, i will provide you a testing apk including the fixes, so that you can check if your problem is also fixed. Here it is:
https://infinite.owncloud.com/s/hmOmoPzUtylHwax
Pwd: LY|3y1[jr(}+
If you have some time, give it a try and come back with your feedback ;)
Thanks!!
mwinters-stuff commentedon Jul 20, 2025
I created an issue earlier, and saw this. Downloaded the app but still no authentication.
jesmrec commentedon Jul 21, 2025
You mean, the app i shared with you? Within the current week, we'll release a new version with latest changes. If the problem persists, we can provide you a safe place in which you could share credentials of your server with us (if you wish), so that we could test with your server instance directly.
jesmrec commentedon Jul 22, 2025
@restonica version
4.6.0has been already released. Could you take a look? let us know whether the problem persistsrestonica commentedon Jul 26, 2025
Hi,
Problem is still present with 4.6.0
joragua commentedon Aug 1, 2025
Hi @restonica! We have just released a new version (
4.6.1), now available on the Play Store! This release includes a potential bugfix for re-login when credentials expire. Could you check it? Let us know if the problem persists 🤔DeepDiver1975 commentedon Jul 2, 2026
Likely already fixed in 4.7.0 (current release: 4.8.2) — needs a retest.
Verified against current
master, the token-refresh persistence path looks correct, so the symptom is not a stale-token storage bug:AccountAuthenticator.javahandleSuccessfulRefreshToken()writesKEY_OAUTH2_REFRESH_TOKENon every successful refresh (falls back to the old one only if the IdP returns none).OCLocalAuthenticationDataSource.addOAuthAccount()overwritesKEY_OAUTH2_REFRESH_TOKENfor the updated account.The Authelia-specific failure looks like the token request, not token storage. #4575 (same setup: OIDC + Authelia, re-auth fails right after a successful login) was fixed in 4.7.0 by #4671 — the token request now sends
client_secret_post/ the authorization header only when the IdP'stoken_endpoint_auth_methods_supportedcalls for it. Authelia commonly usesclient_secret_post, which older builds handled wrong.Timeline note: your last confirmed test was 4.6.0. 4.6.1 (#4654) only changed the re-login
startActivityflow — not the Authelia auth-method fix, which landed later in 4.7.0.Please retest on the latest Play Store build (4.8.2) and report back. If it still fails there, capture the token-request/response (client auth method + error) so we can pin the exact cause.
🤖 Generated with Claude Code