jellyfin / Swiftfin

Native Jellyfin Client for iOS and tvOS
Mozilla Public License 2.0
2.24k stars 250 forks source link

Logged Out Between Sessions [TVOS] #776

Open JPKribs opened 1 year ago

JPKribs commented 1 year ago

I can't get this trigger 100% of the time but I think I narrowed it down to having multiple users on the AppleTV. Since adding another user profile on the AppleTV, all saved Jellyfin users will get wiped after the TV goes to sleep or reboots.

I believe this is related to how session data is stored since this only started once I added other users. On another AppleTV, I have a single user and I have not experienced this issue (yet). I could be totally off base but if my guess is right I think this could be resolved by:

https://github.com/jellyfin/Swiftfin/pull/661

https://github.com/jellyfin/Swiftfin/issues/258

ioslife commented 7 months ago

API keys are not stored in UserDefaults and never should be. I'm not too concerned with the cleanup being a problem as that is something that should have been an issue a long time ago, but it isn't out of the picture.

I disagree, using UserDefaults completely solves the problem. Can you please elaborate on why the app should never store API keys in UserDefaults?

API keys are typically considered private keys. UserDefaults stores data in a text file on the device. https://stackoverflow.com/questions/68022172/why-is-using-userdefaults-to-store-sensitive-information-on-ios-not-safe

extraslute commented 7 months ago

After updating to TVOS 17.1 -- this issue has came back. Logging out every single day at some point.

zandr commented 6 months ago

Is there a workaround that I'm missing here? I'm not sure how this isn't a showstopper. I haven't been able to configure a user that doesn't require a login, which disappears in a day or so.

LePips commented 6 months ago

Sadly there isn't a workaround. Frankly, this issue has been difficult for me because:

So this issue is in the background for me, even though it can make the app practically unusable. I apologize for the inconvenience.

zandr commented 6 months ago

Thanks for the quick response! I was hoping there was some way to get an account to show up in the "Public Users" side of the login screen or similar, but it's not clear how to do that.

I've done exactly no tvOS development, but if you can point me at a guide to running the debugger, I actually could hang a spare machine off of one of our AppleTVs.

Raphty commented 6 months ago

Have not been logged out since the new tv os update. Maybe that fixed it? (sep. 24th)

Since then I never got logged out again.

Maybe it is a different issue.

imperialjoy commented 6 months ago

Still happens to me. Is there a way to use jellyfin in DLNA mode without logging in? Is there a different way to store user credentials? Or setup Jellyfin to not need credentials? Seems like overkill for a LAN connection to the media server right beside the ATV.

BDub38 commented 3 weeks ago

It has been some time since the last comment on this thread. Has there been any progress or updates regarding this issue? I am still experiencing this. Sometimes it is daily or many days between the need to log in again.

JPKribs commented 3 weeks ago

This isn't a perfect fix, but it appears to happen when storage is low on the Apple TV. If you turn off the download screensaver option in the Apple TV settings and stop iCloud photos from syncing to the TV, it prevents the issue from occurring on my end. When I was doing some research it it sounds like Apple has a pretty aggressive cleanup process when storage starts getting low and Apple prioritizes retaining data from their own apps over third-party apps from the store so things like Infuse and Jellyfin have issues where the data gets wiped.

That being said, I think Jellyfin might be able to resolve this by moving how the credentials are stored? But I am absolutely not an expert, so I'll lean on more qualified people.