jellyfin / jellyfin-expo

Jellyfin Mobile for iOS
https://jellyfin.org
Mozilla Public License 2.0
288 stars 65 forks source link

IOS app keeps the old token #489

Closed Bm-TM closed 1 month ago

Bm-TM commented 1 month ago

Describe the bug I don't really know why, but I'm getting "CustomAuthentication was not authenticated. Error message: Invalid token" for a few moments now. But in basic browsers (like Safari, Firefox, Google Chrome ..) I just have to empty the cache. But that is impossible with the IOS application, so the app keeps asking for a session with an old token stored. The only i found now is to to remove the app, and reinstall again.

I think what happened is that the client (here the application) got a 401 error from the server. In this case, you can just automatically delete the old token from the client and ask the user to login again, instead of displaying a completely empty home page with no message and errors.

System (please complete the following information):

To Reproduce

  1. Login first in the app
  2. clear all session or the ios app session from the server
  3. come back to the app... an empty page will be displayed

Expected behavior I think what happened is that the client (here the application) got a 401 error from the server. In this case, you can just automatically delete the old token from the client and ask the user to login again, instead of displaying a completely empty home page with no message and errors.

Additional context It happens in browser clients too... I think that the same solution can be used

thornbill commented 1 month ago

Please check if this issue is resolved in the 10.9.3 server release.

Bm-TM commented 1 month ago

Hi, i tried and no. The issue isn't resolved in the 10.9.3 server release

thornbill commented 1 month ago

Well it turns out the thing that was supposed to be fixed in 10.9.3 was not fixed... 10.9.4 should resolve it when it is released... hopefully :crossed_fingers:

dezza commented 1 month ago

I have the same problem. Here's an easy way to reproduce it:

You have WAN IP and LAN IP to jellyfin

  1. Add WAN IP, authenticate. It shows dashboard, items, everything works as expected.
  2. Add LAN IP (no authentication prompt comes up), but nothing works.

You have to delete the app, you can't just "Reset application" its not enough.

In the log:

Jun 01 20:36:13 cos jellyfin[697355]: [18:36:13] [ERR] [62] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request: Invalid token. URL GET /socket.
Jun 01 20:36:13 cos jellyfin[697355]: [18:36:13] [INF] [62] Jellyfin.Api.Auth.CustomAuthenticationHandler: CustomAuthentication was not authenticated. Failure message: Invalid token.

I assume each token is tied to URL/address why it breaks. Each name is shown in the header of each server entry and I assume this servername is tied to token, but only has 1 entry (the first one added, which makes the 2nd addr invalid, always)

Bm-TM commented 1 month ago

Yes it can be reproduced like that too

Bm-TM commented 1 month ago

Well it turns out the thing that was supposed to be fixed in 10.9.3 was not fixed... 10.9.4 should resolve it when it is released... hopefully 🤞

Yes i just try 10.9.4 and this issue is fixed now. Thanks you