Skip to content

Commit

Permalink
fix(oauth): use clearer instructions for login failure
Browse files Browse the repository at this point in the history
  • Loading branch information
BastiDood committed Aug 10, 2024
1 parent 22fc864 commit 2caa0a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/routes/oauth/callback/+server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export async function GET({ fetch, locals: { db }, cookies, url: { searchParams
const hashedSessionId = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(sid));
if (Buffer.from(state, 'base64url').compare(Buffer.from(hashedSessionId)) !== 0) {
cookies.delete('sid', { path: '/', httpOnly: true, sameSite: 'lax' });
error(400, 'Session state mismatch detected. Please log in again or clear your browser cookies.');
error(
400,
'Session state mismatch detected. Please (1) refresh the page, (2) clear your browser cache cookies, or (3) log in again.',
);
}

const body = new URLSearchParams({
Expand Down

0 comments on commit 2caa0a4

Please sign in to comment.