Skip to content

Commit b8123fe

Browse files
committed
fix: Use Lax mode for OAuth redirect cookies (#1162)
OAuthing was resulting in an error, because Strict cookies are not sent on redirects.
1 parent 99ee423 commit b8123fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/httpmw/oauth2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func ExtractOAuth2(config OAuth2Config) func(http.Handler) http.Handler {
7171
Value: state,
7272
Path: "/",
7373
HttpOnly: true,
74-
SameSite: http.SameSiteStrictMode,
74+
SameSite: http.SameSiteLaxMode,
7575
})
7676
// Redirect must always be specified, otherwise
7777
// an old redirect could apply!
@@ -80,7 +80,7 @@ func ExtractOAuth2(config OAuth2Config) func(http.Handler) http.Handler {
8080
Value: r.URL.Query().Get("redirect"),
8181
Path: "/",
8282
HttpOnly: true,
83-
SameSite: http.SameSiteStrictMode,
83+
SameSite: http.SameSiteLaxMode,
8484
})
8585

8686
http.Redirect(rw, r, config.AuthCodeURL(state, oauth2.AccessTypeOffline), http.StatusTemporaryRedirect)

0 commit comments

Comments
 (0)