mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-02 22:46:55 -05:00
[Bug]: Need to re-login very often #2975
Labels
No labels
authentication
awaiting release
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/audiobookshelf-advplyr#2975
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @D3r3k23 on GitHub (Aug 27, 2025).
What happened?
After the update to authentication, it's automatically logging out multiple times per day. It usually is slow for a bit, then goes back to the login screen. This is happening on both the web UI and the Android app.
What did you expect to happen?
I'm not sure but the login session should last longer.
Steps to reproduce the issue
Audiobookshelf version
v2.29.0
How are you running audiobookshelf?
Docker
What OS is your Audiobookshelf server hosted from?
Other (list in "Additional Notes" box)
If the issue is being seen in the UI, what browsers are you seeing the problem on?
Chrome
Logs
Additional Notes
Unraid OS
@nichwall commented on GitHub (Aug 27, 2025):
What do the logs say?
@D3r3k23 commented on GitHub (Aug 28, 2025):
This part of the logs should cover one of the times that it happened. At 22:22:45.162 I logged in, but I don't know if there's anything from when it logged me out.
@D3r3k23 commented on GitHub (Sep 7, 2025):
I get this message about the new authentication when I have to re-login. Was this just supposed to be for the first time you login after updating or is it just on the login screen now?
@000al000 commented on GitHub (Dec 16, 2025):
Same problem, need relogin about week
2025-12-16 08:50:35.341
ERROR
[TokenManager] Failed to refresh token. Session not found for refresh token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0OWNhYzJhZi03M2FlLTQ3MzUtOGI4NS03NjE0YzQyMGJkZGYiLCJ1c2VybmFtZSI6InJvb3QiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTc2NTc5MTU2OSwiZXhwIjoxNzY2Mzk2MzY5fQ.ZtUOBHNOiLY-yXmHXQnNofHLlLsHGwbsnvXoHmdwRIw
@Vito0912 commented on GitHub (Dec 16, 2025):
For your info. You should never, ever share aboves token. It's like a password. If that would be an old token, anyone would be able to login to your server.
Anyway, that above will expire soon and anyway is not valid as you said
But it looks like the session got deleted.
As long as you did not lgog out, which makes no sense, the only line that probably would affect this is:
github.com/advplyr/audiobookshelf@626596b192/server/auth/TokenManager.js (L364-L393)because it invalidates all refresh tokens, which sounds like the cause and, as far as I can tell is the only occurrence of invalidating all sessions
@JamesRagnar commented on GitHub (Dec 16, 2025):
I can second this, every so often my refresh token is rejected and the server logs a "Failed to refresh token. Session not found for refresh token" error. I haven't seen a consistent cause for this, it seems to fail about 1 of 5 app launches when I call
/auth/refresh.I'm working on adding a bit more logging and double checking I'm not making duplicate requests or anything, but figured it was worth checking in if there are any scenarios that could lead to a deleted session like this.
@D3r3k23 commented on GitHub (Dec 16, 2025):
On my system, the audiobookshelf server regularly goes unresponsive, and the app loses connection. Sometimes when this happens, I need to re-login when it gets connected again. Also, sometimes when it asks me to login again, I can close and reopen the app to skip the login screen.
@lagset commented on GitHub (Dec 28, 2025):
JFYI: I observe exactly this behaviour on my instance (docker + traefik reverse proxy). I mostly use the android audiobookshelf app for playback. Re-logins occur about once a week. I use audiobookshelf mainl on a daily basis.
@biondogs commented on GitHub (Dec 29, 2025):
I third this exact experience.
I'm using docker and Nginx Proxy Manager.
@Vito0912 commented on GitHub (Dec 29, 2025):
For all that experience this: Do you do something special (e.g. daily restarts, database on network drive or similar etc.).
Anything that not every user does (/ only very few users)
@biondogs commented on GitHub (Dec 29, 2025):
I think my use case is fairly typical.
Android app on several devices, one primary device.
Occasional webplayer use, 90% used with android auto in car.
About once per day, typically first use of day, app opens disconnected from server, with no books available. Either close app or reconnect manually, everything returns. Usually holds that way for at least the next several android auto sessions of the day. Then at some point auth / disconnect.
I do have the battery optimizations off, not using a power save profile.
I do switch from WiFi to mobile several times throughout the day.
@lagset commented on GitHub (Dec 29, 2025):
I am one of the affected users. my setup should be fairly typical:
Setup
Usage
Accessing/Playback mainly with Apps:
Two main user accounts, one admin user account
Usage locally in LAN or remotely by connecting the client device using Wireguard to local network (both playbacks work)
There is, so far, no recognizable pattern to when the re-authentication appears. It's not one single client, it appears when connected internally as well as externally (VPN).
If it helps, I can of course provinde additional resources like logs or the used docker compose file.
Thanks for looking into this!
@JamesRagnar commented on GitHub (Jan 4, 2026):
I'm a bit of an edge case, working on a personal third party app on iOS. Server has been running consistently for some time with no changes. I get these events irregularly, without a consistent repro unfortunately.
I store the refresh token in keychain and use it to elevate to a full online session on each app launch. There is also a basic re-auth flow that catches unathentication events and attempts to renew the token where applicable. For both of these, I get an irregular error where the server can't seem to find the associated session for that token. I tend not to log out unless testing something through that flow, often I'm just launching the app to check some work and 20% of the time it won't accept the refresh token.
@ggrensteiner commented on GitHub (Jan 5, 2026):
I was getting this daily on the latest android client. Traefik+official current docker server+authentik
Downgraded to 9.81-beta and it hasn't happened for 5 days.
Also that obnoxious 35 second delay on opening the app doesn't occur on 9.81-beta
Maybe the place to look is client side, not server side.
@D3r3k23 commented on GitHub (Jan 6, 2026):
I can think of a couple possibilities.
Large podcast library:
My library has 125 podcasts, and most of the podcasts have scheduled automatic episode downloads.
Memory issues:
I've had some problems with my server running out of memory, and being slow/unresponsive as a result. But I've removed some services that had high memory usage and I don't think I'm experiencing this issue anymore.
Not for the issue I have. It's been going on for a while, on both the web client and Android app.
@jneidel commented on GitHub (Jan 19, 2026):
This sounds like what has been happening to me too. Says "Failed to refresh token" and I need to relogin on my android about once a week (docker + nginx proxy manager).
@meerumschlungen commented on GitHub (Jan 19, 2026):
Same here, experienced in Prologue and plappa (both iOS) and pocket-id as native OIDC IDP for ABS.
@Crononaut commented on GitHub (Jan 19, 2026):
Same issue since updating to v2.32.1
Funny thing is, I have one more user on my server. He uses the android app too, but he says that it doesn't happen to him.
It seems that I have to re-authenticate about every hour or something. Sometimes it even keeps playing in the background but prompting me to login again if trying to access the app.
Also, keep getting an "error synchronizing, restart playback to fix" or something error after update.
(Docker + nginx proxy manager + cloudflare reverse proxy tunnel)
[2026-01-19 16:00:51.813] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:00:51.813] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:00:51.824] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:01:53.773] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19267
[2026-01-19 16:01:53.793] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:01:53.793] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:01:53.801] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:03:08.806] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19341
[2026-01-19 16:03:08.820] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:03:08.820] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:03:08.830] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:03:41.634] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19373
[2026-01-19 16:03:41.653] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:03:41.653] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:03:41.666] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:04:17.626] DEBUG: [SessionController] Serving audio track 1 for session "ce9e626e-1c97-414d-901c-e7efaa0f79c7" belonging to user "Username"
[2026-01-19 16:04:17.865] INFO: [SocketAuthority] Socket Connected to /socket.io 2PvQptvQw2a6KiaZAAJS
[2026-01-19 16:04:18.011] DEBUG: [SocketAuthority] Authenticating socket to user "Username"
[2026-01-19 16:05:17.570] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19433
[2026-01-19 16:05:17.584] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:05:17.594] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:05:32.534] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19508
[2026-01-19 16:05:32.556] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:05:32.566] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:05:47.526] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19598
[2026-01-19 16:05:47.544] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:05:47.553] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:05:52.936] DEBUG: [SocketAuthority] User Offline Username
[2026-01-19 16:05:52.937] INFO: [SocketAuthority] Socket 2PvQptvQw2a6KiaZAAJS disconnected from client "Username" after 95072ms (Reason: ping timeout)
[2026-01-19 16:05:52.938] DEBUG: [SocketAuthority] Socket 2PvQptvQw2a6KiaZAAJS disconnected, any active searches will timeout
[2026-01-19 16:06:02.515] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19703
[2026-01-19 16:06:02.536] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:06:02.536] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:06:02.544] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:07:17.649] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19768
[2026-01-19 16:07:17.669] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:07:17.669] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:07:17.678] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:08:32.552] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19842
[2026-01-19 16:08:32.568] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:08:32.569] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:08:32.580] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:09:47.550] DEBUG: [PlaybackSessionManager] syncSession "ce9e626e-1c97-414d-901c-e7efaa0f79c7" (Device: CPH2581 SDK 36 / v0.10.1-beta) | Total Time Listened: 19916
[2026-01-19 16:09:47.569] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache
[2026-01-19 16:09:47.569] DEBUG: [SocketAuthority] clientEmitter - no clients found for user 21e4f038-3f09-445b-bfe0-88acae0c34a8
[2026-01-19 16:09:47.578] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
[2026-01-19 16:10:02.654] DEBUG: [Auth] refreshing token. shouldReturnRefreshToken: true
[2026-01-19 16:10:02.664] DEBUG: [ApiCacheManager] session.afterUpdate: Clearing cache
[2026-01-19 16:10:17.669] DEBUG: [Auth] refreshing token. shouldReturnRefreshToken: true
[2026-01-19 16:10:17.672] ERROR: [TokenManager] Failed to refresh token. Session not found for refresh token: ------
[2026-01-19 16:30:39.584] INFO: Received ping
[2026-01-19 16:30:39.888] DEBUG: [Auth] refreshing token. shouldReturnRefreshToken: true
[2026-01-19 16:30:39.891] ERROR: [TokenManager] Failed to refresh token. Session not found for refresh token: ------
026-01-19 16:30:48.312] INFO: [LocalAuth] User "Username" logged in from ip xxx.xxx.xxx.xxx
[2026-01-19 16:30:48.323] DEBUG: [ApiCacheManager] session.afterCreate: Clearing cache
[2026-01-19 16:30:48.324] DEBUG: [Auth] handleLoginSuccess: returnTokens: true, isRefreshTokenInResponse: true
[2026-01-19 16:30:48.554] DEBUG: [ApiCacheManager] count: 0 size: 0
[2026-01-19 16:30:48.607] DEBUG: Loaded 5 of 5 items for "Continue Listening/Reading" in 0.05s
[2026-01-19 16:30:48.644] DEBUG: Loaded 1 of 1 items for "Continue Series" in 0.04s
[2026-01-19 16:30:48.675] DEBUG: Loaded 10 of 11 items for "Recently Added" in 0.03s
[2026-01-19 16:30:48.696] DEBUG: Loaded 2 of 2 series for "Recent Series" in 0.02s
[2026-01-19 16:30:48.714] INFO: [SocketAuthority] Socket Connected to /socket.io MdoWTq8UN17dpqR5AAJU
[2026-01-19 16:30:48.730] DEBUG: [ApiCacheManager] count: 0 size: 0
[2026-01-19 16:30:48.736] DEBUG: Loaded 10 of 14 items for "Discover" in 0.04s
[2026-01-19 16:30:48.740] DEBUG: [ApiCacheManager] Cache miss: {"user":"Username","url":"/libraries"}
[2026-01-19 16:30:48.758] DEBUG: Loaded 10 of 29 items for "Listen/Read Again" in 0.02s
[2026-01-19 16:30:48.763] DEBUG: Loaded 4 of 4 authors for "Newest Authors" in 0.00s
[2026-01-19 16:30:48.764] DEBUG: Loaded 7 personalized shelves in 0.21s
[2026-01-19 16:30:48.764] DEBUG: [ApiCacheManager] Cache miss: {"user":"Username","url":"/libraries/f9420db2-2522-40c9-8f60-5758717496c3/personalized?minified=1&include=rssfeed,numEpisodesIncomplete"}
[2026-01-19 16:30:48.764] DEBUG: [ApiCacheManager] Caching with 1800000 ms TTL
[2026-01-19 16:30:48.773] DEBUG: [SocketAuthority] Authenticating socket to user "Username"
[2026-01-19 16:30:48.826] DEBUG: [ApiCacheManager] count: 2 size: 74868
[2026-01-19 16:30:48.833] DEBUG: Filter data for f9420db2-2522-40c9-8f60-5758717496c3 has not changed, returning cached data and updating cache time after 0.01s
[2026-01-19 16:30:48.834] DEBUG: [ApiCacheManager] Cache miss: {"user":"Username","url":"/libraries/f9420db2-2522-40c9-8f60-5758717496c3?include=filterdata"}
[2026-01-19 16:30:49.136] DEBUG: [ApiCacheManager] Object.afterBulkUpdate: Clearing cache
@meerumschlungen commented on GitHub (Jan 20, 2026):
I tried around a bit and I can't reproduce the problem by forcefully recreating the ABS container nor by restarting the docker engine, so from my understanding (limited, as I don't know about the ABS code) the refresh token should get correctly persisted permanently in the application layer but for some reason ABS does not refresh the session in time.
@tburnsed commented on GitHub (Feb 3, 2026):
I was having this issue, using Nginx Proxy Manger. It would log me out if did not use the app for more then a few minutes.
I have added the following to my my Ngnix proxy manager config as well as making sure websocks is on, Cache Assets and Block Common Exploits are off:
proxy_connect_timeout 86400s;
proxy_send_timeout 86400s;
proxy_read_timeout 86400s;
send_timeout 86400s;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
After a week of testing It has not asked me to login once, up to 2 days between uses.
@KotMountain commented on GitHub (Feb 8, 2026):
I’m seeing this issue with multiple mobile clients on one of my devices. I don’t experience it as often if I’m playing from a downloaded book. Running the latest docker version with Zoraxy reverse proxy providing SSL. Clients exhibiting the issue have been ABS, Prologue, Tonspur, and AudioBooth.
@PraetorAugustus commented on GitHub (Feb 10, 2026):
Same problem here, ALMOST.
My wife has to re-authenticate about once a week. I don't.
We're both using the same ABS server, same network, same player (AudioBooth on iOS).
She's a User and I'm an Admin. That's the only difference in our setup. I don't think that's the reason, but correct me if I'm wrong.
Server setup:
ABS 2.32.1
Docker on Synology DSM 7.3.2
64 GB RAM (which is overkill, I know... RAM was cheap back then)
I'll keep an eye on the logs, I guess.
@cookie-monster1649 commented on GitHub (Feb 17, 2026):
Same issue here. I'm running
iOS Version 1.6 (1768540294)
Docker version 2.32.1
I'm connecting via Tailscale with username/pw auth and get logged out multiple times a day.
It's just me, one app one docker instance. No other apps or instances are connected except for the one iOS app.
@jneidel commented on GitHub (Feb 17, 2026):
The Nginx proxy manager configuration of @tburnsed worked for me. Have not had any log-outs for two weeks.
To me this confirms it as a proxy misconfiguration, not an application issue. Should probably still be added to the docs.
@nichwall commented on GitHub (Feb 17, 2026):
This does not make sense for fixing the logout problem. You are:
I could see the issue being related to the request timeout and a race condition found in the server, but I personally have not had this happen to me (my wife has, so I know it can happen with my current configuration but I haven't ever experienced). An attempt to fix it is here https://github.com/advplyr/audiobookshelf/pull/5004, but needs review.
@dojoca commented on GitHub (Feb 19, 2026):
Experiencing the same issue here on 2.32.1 with Prologue on iOS 26.