mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
🐛 Bug Report: (Caddy-security + Pocket-Id) Token expiry causes 401 error and needs manual fixing #364
Reference in New Issue
Block a user
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 @empressmarissa on GitHub.
Reproduction steps
When a token expires it doesn't seem to redirect to either the login page or auto-renewal of the token. As soon as the token expires I get send to a blank page (I get a 401 back from Caddy, see below for response and log). Manually deleting the cookie and going back to the domain (code.domain.tld) is the only way to get it to work again (it needs me to reauthenticate with pocket-id passkey).
Using Firefox, Caddy (with Caddy Security, both latest) as a proxy for my services and Pocket-Id v0.27.2
After token expiry firefox tries to navigate to this page, returning a 401 and nothing else happening.
GET https://code.domain.tld/auth/oauth2/generic/?login_hint=<EMAIL>&redirect_url=https://code.domain.tld/?folder=/appdataRESPONSE
Caddy Logs:
Relevant Caddyfile bits:
Pocket-ID setup:
OIDC Client has a single (wildcard) callback url: https://*.domain.tld/auth/oauth2/generic/authorization-code-callback
Expected behavior
It should redirect me to my pocket-id login page or do a silent renew of my token
Actual Behavior
See above, the page refuses to load (401, access-token cookie doesn't get removed either). Only manually deleting the cookie and navigating to the base domain seems to work. I'm sure I'm missing something incredibly simple here but I'm staring at blanks at the moment.
Version and Environment
v0.27.2
Log Output
No response
@TreatnHerRight commented on GitHub:
Happening with me as well. Had to clear the cookie and re authenticate.
Version v0.28.0
@kmendell commented on GitHub:
Ill confirm this issue, Its happened to me as well. I started to look into it , but then got side tracked. Ill see what i can find.
@stonith404 commented on GitHub:
It's probably not a issue with Pocket ID itself but with the example Caddy configuration from the docs.
@empressmarissa commented on GitHub:
Upgraded to v0.28.0, issue still persists (didn't expect it to get fixed by that version anyway).
@kmendell commented on GitHub:
@stonith404 Ill try to show you this later tonight, as i have many caddy-security apps setup, so i can try to reproduce it for you to help troubleshoot.
@TreatnHerRight commented on GitHub:
The new config successfully routes correctly. I will report back if i get the 401 error.
@stonith404 commented on GitHub:
The example was actually wrong. The updated example should now work correctly with re-authentication. See my commit (
19ef4833e9) for the necessary changes.