jeffvli / feishin

A modern self-hosted music player.
https://feishin.vercel.app
GNU General Public License v3.0
2.02k stars 79 forks source link

Session is expired when alt tabbing #214

Closed pokemonrocks9 closed 2 months ago

pokemonrocks9 commented 10 months ago

Expected Behavior

Feishin open and use the server

Current Behavior

Feishin will open for a short period of time then when alt tabbing suddenly closes the server and says session is expired. Server is a Jellyfin.

Server crash in Feishin

Unable to atm

Steps to Reproduce

Open Feishin, sign in, alt tab.

Unfortunately cannot yet

1.

2.

3.

4.

Possible Solution (Not obligatory)

Context

Your Environment

jeffvli commented 10 months ago

I don't think the issue is related to alt tabbing, my thoughts are that it's a permissions related issue that I'm unaware about on Jellyfin.

Is the person Feishin accessing your server on an account with limited permissions to your server?

pokemonrocks9 commented 10 months ago

To my knowledge they have the same permission as most on the server and it's only them with the issue.

On Fri, Aug 11, 2023, 11:47 PM Jeff @.***> wrote:

I don't think the issue is related to alt tabbing, my thoughts are that it's a permissions related issue that I'm unaware about on Jellyfin.

Is the person Feishin accessing your server on an account with limited permissions to your server?

— Reply to this email directly, view it on GitHub https://github.com/jeffvli/feishin/issues/214#issuecomment-1675663217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGYPBCPNBTTPINFDLCES4MLXU34FVANCNFSM6AAAAAA3NM6NNA . You are receiving this because you authored the thread.Message ID: @.***>

jeffvli commented 10 months ago

Feishin logs you out if you get a HTTP 401 status code on any API request.

Can you have them open the browser dev tools via CTRL + SHIFT + I or from the app menu and try replicating the issue and checking which API request is giving them the 401?

https://github.com/jeffvli/feishin/blob/663893dccb551bc28f1e3057c1758c627a9fbb62/src/renderer/api/jellyfin/jellyfin-api.ts#L272-L276

pokemonrocks9 commented 10 months ago

It seems in console we have Failed to load resource: the server responded with a status of 401 (Unauthorized) (Server IP and UserToken)/items?Fields=ChildCount%2C%20Genres%2C%20DateCreated%2C%20ParentId%2C%20Overview&IncludeItemTypes=Playlist&MediaTypes=Audio&Recursive=true&SortBy=SortName&SortOrder=Ascending&StartIndex=0

To add as well I have begun getting the same error

pokemonrocks9 commented 10 months ago

Also have a token is expired: undefined renderer.js:2

Adding a photo of their error tayerrorfeishin

jeffvli commented 10 months ago

Sorry for the late response, but I believe this may have had something to do with how the app was fetching playlists (not 100% sure). I've added a way to re-authenticate whenever running into the expired session.

Going to close this for now, but will we can re-open this if you still experience this after the next release.

silverfs commented 8 months ago

Hi, I hope I am wrong on my end, but from the looks of it, this issue needs to be opened again.

I have been getting random "session expired" with the same 401 'unauthorized' as seen here in this issue. This issue has been present for me and my family members since version 4.0.0, and frequent entry of login credentials has become muscle memory 😅. I have used Jellyfin 10.8.10 ~and am currently on 10.8.11~, both having the same issue on Feishin.

I mainly use the Windows version of Feishin, but have seen random "expired" sessions on Mac and in the browser version as well. Is there something I'm missing?

P.S.: Sorry for only reporting this just now, I was incredibly busy.

edit: I'm currently on 10.8.10, as playlists in 3rd party apps haven't been able to show up on that version yet.

Mihara commented 4 months ago

I'm also noticing mysterious "session expired" after long disuse with Navidrome, both Navidrome and Feishin running on Linux.

Opening the server edit page and re-saving gets it going again, at least.

kgarner7 commented 4 months ago

I'm also noticing mysterious "session expired" after long disuse with Navidrome, both Navidrome and Feishin running on Linux.

Opening the server edit page and re-saving gets it going again, at least.

This is not mysterious; Navidrome's credentials are temporary (https://www.navidrome.org/docs/usage/configuration-options/#:~:text=false-,sessiontimeout,-ND_SESSIONTIMEOUT). When you save the password or re-save the server, it generates new credentials. This is unlike Jellyfin, whose credentials do not expire (as far as I understand)

Mihara commented 4 months ago

This is not mysterious;

Session timing out might not be mysterious, what's mysterious is why Feishin does not recreate it automatically like every other client. It has the password and username saved right there, after all.

kgarner7 commented 4 months ago

This is not mysterious;

Session timing out might not be mysterious, what's mysterious is why Feishin does not recreate it automatically like every other client. It has the password and username saved right there, after all.

If (and only if) you selected save password, then it should reauthenticate on failure. But this could also be blocked by #403 (resolved hopefully by #510). If you're using web, the password is never stored

kgarner7 commented 2 months ago

I will be closing this issue as the issue in my earlier comment was addressed (and some better fixes done).