You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dev OAuth provider runs on a separate port (default 8084) from the main application. Since Chrome 80 (February 2020), browsers treat cookies without explicit SameSite attribute as SameSite=Lax by default. This breaks the dev OAuth flow because:
User visits 127.0.0.1:8080/auth/dev/login - JWT handshake cookie is set on port 8080
Browser redirects to 127.0.0.1:8084/login/oauth/authorize (dev OAuth server)
Dev OAuth redirects back to 127.0.0.1:8080/auth/dev/callback
Cookie is NOT sent because browsers treat different ports as different origins for SameSite purposes
Error: failed to get token - token cookie was not presented: http: named cookie not present
Why this happens
Before 2020: Browsers sent cookies without SameSite restrictions
After Chrome 80: Cookies default to SameSite=Lax, blocking cross-origin redirects
Different ports (8080 vs 8084) = different origins from browser's cookie perspective
Setting SameSite=None requires Secure=true which requires HTTPS (not practical for local dev)
Setting SameSite=Lax or default doesn't help because modern browsers enforce Lax by default
Proposed Solution
Add an option to run the dev OAuth handler on the same port as the main application using path-based routing instead of port-based separation.
// Configure with OAuthBasePathauthenticator.AddDevProvider("", 0, "/auth/dev/oauth")
// Get handler and mount on main routerdevHandler, _:=authenticator.DevAuthHandler()
router.Mount("/auth/dev/oauth", devHandler)
Problem
The dev OAuth provider runs on a separate port (default 8084) from the main application. Since Chrome 80 (February 2020), browsers treat cookies without explicit
SameSiteattribute asSameSite=Laxby default. This breaks the dev OAuth flow because:127.0.0.1:8080/auth/dev/login- JWT handshake cookie is set on port 8080127.0.0.1:8084/login/oauth/authorize(dev OAuth server)127.0.0.1:8080/auth/dev/callbackError:
failed to get token - token cookie was not presented: http: named cookie not presentWhy this happens
SameSite=Lax, blocking cross-origin redirectsSameSite=NonerequiresSecure=truewhich requires HTTPS (not practical for local dev)SameSite=Laxordefaultdoesn't help because modern browsers enforce Lax by defaultProposed Solution
Add an option to run the dev OAuth handler on the same port as the main application using path-based routing instead of port-based separation.
API Changes
OAuthBasePathfield toParams:Handler()method toDevAuthServer:DevAuthHandler()toService:Usage (same-port mode)
Backward Compatibility
OAuthBasePathReferences