Fix shared OAuth exchange SQL by avoiding a reserved identifier
Foundry Go checks / check (push) Successful in 2m10s
Foundry Go checks / check (pull_request) Successful in 2m11s

This commit is contained in:
2026-11-05 18:55:29 +08:00
parent f69575d48f
commit 9d5ab9e215
+2 -2
View File
@@ -284,13 +284,13 @@ func (s *service) exchange(w http.ResponseWriter, r *http.Request, project strin
}
session := token()
result, err := s.db.ExecContext(r.Context(), `
WITH grant AS (
WITH redeemed_grant AS (
DELETE FROM login_grants
WHERE token_hash = $1 AND project = $2 AND frontend_challenge = $3 AND expires_at > now()
RETURNING account_id
)
INSERT INTO project_sessions
SELECT $4, $2, account_id, now() + interval '8 hours' FROM grant
SELECT $4, $2, account_id, now() + interval '8 hours' FROM redeemed_grant
`, digest(code), project, digest(verifier), digest(session))
if err != nil {
return err