History

callback

Rhys Sullivan committed 8 months ago

Commit 0ec73051 parent 73369fb1 file · +5 −29Browse files

Unified · Split

executor/apps/web/src/lib/workos-callback.ts+5−29
@@ -171,38 +171,14 @@ export async function handleWorkOSCallback(context: WorkOSCallbackInput): Promis · 170 unmodified lines
171171 }
172172
173173 if (code && response.status >= 300 && response.status < 400) {
174− if (setCookieHeaders.length > 0) {
175− markCodeAsReplayed(code);
176−
177− if (isWorkosDebugEnabled()) {
178− logWorkosAuth("callback.code-marked-used", {
179− requestId,
180− code: redactAuthCode(code),
181− status: response.status,
182− setCookieCount: setCookieHeaders.length,
183− });
184− }
185− }
186− else if (isWorkosDebugEnabled()) {
187− logWorkosAuth("callback.code-not-marked-used", {
174+ markCodeAsReplayed(code);
175+
176+ if (isWorkosDebugEnabled()) {
177+ logWorkosAuth("callback.code-marked-used", {
188178 requestId,
189179 code: redactAuthCode(code),
190180 status: response.status,
191− reason: "missing-set-cookie",
192− });
193− }
194−
195− if (setCookieHeaders.length === 0) {
196− return new Response(JSON.stringify({
197− error: {
198− message: "Authentication did not set a session cookie",
199− description: "Sign-in completed but the callback response did not include Set-Cookie.",
200− },
201− }), {
202− status: 500,
203− headers: {
204− "Content-Type": "application/json",
205− },
181+ setCookieCount: setCookieHeaders.length,
206182 });
207183 }
208184