IgnisDa / ryot

Roll your own tracker!
https://ryot.io
GNU General Public License v3.0
2k stars 55 forks source link

InvalidTokenError: Invalid token specified: missing part #2 #1100

Closed saschabrockel closed 1 week ago

saschabrockel commented 1 week ago

Since your latest release from yesterday I get the following error and I don't know where it comes from or how I'm able to fix it.

I can also give you my Docker container config if needed.

[backend] 2024-11-04T16:17:43.161028Z  INFO ryot: Running version: v7.9.0
[backend] 2024-11-04T16:17:43.194510Z  INFO sea_orm_migration::migrator: Applying all pending migrations
[backend] 2024-11-04T16:17:43.197838Z  INFO sea_orm_migration::migrator: No pending migrations
[backend] 2024-11-04T16:17:43.198537Z  INFO ryot: Timezone: Europe/Berlin
[proxy] {"level":"info","ts":1730737063.235844,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
[proxy] {"level":"warn","ts":1730737063.240048,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":30}
[proxy] {"level":"warn","ts":1730737063.2402923,"logger":"admin","msg":"admin endpoint disabled"}
[proxy] {"level":"warn","ts":1730737063.2407398,"logger":"http.auto_https","msg":"automatic HTTPS is completely disabled for server","server_name":"srv0"}
[proxy] {"level":"info","ts":1730737063.240827,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0003ba600"}
[proxy] {"level":"info","ts":1730737063.2422936,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/home/ryot/.local/share/caddy"}
[proxy] {"level":"info","ts":1730737063.2423482,"logger":"tls","msg":"finished cleaning storage units"}
[proxy] {"level":"info","ts":1730737063.2429228,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
[proxy] {"level":"info","ts":1730737063.243112,"msg":"autosaved config (load with --resume flag)","file":"/home/ryot/.config/caddy/autosave.json"}
[proxy] {"level":"info","ts":1730737063.2431188,"msg":"serving initial configuration"}
[backend] 2024-11-04T16:17:44.368403Z  INFO ryot: Listening on: 0.0.0.0:5000
[frontend] [remix-serve] http://localhost:3000 (http://172.18.0.96:3000)
[frontend] InvalidTokenError: Invalid token specified: missing part #2
[frontend]     at jwtDecode (file:///home/ryot/node_modules/jwt-decode/build/esm/index.js:42:15)
[frontend]     at getDecodedJwt (file:///home/ryot/build/server/index.js?t=1730525170000:974:10)
[frontend]     at getCachedUserDetails (file:///home/ryot/build/server/index.js?t=1730525170000:983:22)

Docker container config:

docker run
  -d
  --name='ryot'
  --net='unraid'
  -e TZ="Europe/Berlin"
  -e 'FRONTEND_INSECURE_COOKIES'='true'
  -e 'DATABASE_URL'='postgres://username:password@ryot-db:5432/ryot'
  -e 'FRONTEND_URL'='http://192.168.178.29:8010'
  -e 'SERVER_OIDC_CLIENT_ID'='xyz'
  -e 'SERVER_OIDC_CLIENT_SECRET'='xyz'
  -e 'SERVER_OIDC_ISSUER_URL'='https://xyz.de/application/o/ryot/'
  -e 'TZ'='Europe/Berlin'
  -e 'SERVER_SMTP_SERVER'='xyz'
  -e 'SERVER_SMTP_PORT'='587'
  -e 'SERVER_SMTP_USER'='xyz'
  -e 'SERVER_SMTP_PASSWORD'='xyz'
  -e 'SERVER_SMTP_MAILBOX'='Ryot <xyz>'
  -e 'SERVER_ADMIN_ACCESS_TOKEN'='xyz'
  -p '8010:8000/tcp'
  --restart=unless-stopped
  --health-cmd="curl
  --fail http://localhost:8000/health || exit 1"
  --health-interval=1m
  --health-timeout=10s
  --health-retries=3 'ghcr.io/ignisda/ryot:latest'
IgnisDa commented 1 week ago

Can you try clearing cookies in the browser?

IgnisDa commented 1 week ago

Also you can remove -e 'FRONTEND_INSECURE_COOKIES'='true'. It is no longer used.

IgnisDa commented 1 week ago

Merged a fix. Will be released this weekend.

I added a check for malformed JWTs, so the frontend will be able to recover from this problem. Meanwhile, LMK if clearing the cookies does not fix the issue.

saschabrockel commented 1 week ago

I was so tired that I didn't realize the logout button. Clearing cookies didn't even work. Then I pressed logout and got to login page again instead of this error page and could log in normally and now everything works.