update docker image + error messages on auth callback

This commit is contained in:
Torben Haack 2024-10-10 14:29:25 +02:00
parent 682a6b0b18
commit ff77d013eb
2 changed files with 20 additions and 8 deletions

Binary file not shown.

View File

@ -15,9 +15,15 @@ export async function GET(request: Request): Promise<Response> {
const state = url.searchParams.get("state");
const storedState = cookies().get("github_oauth_state")?.value ?? null;
if (!code || !state || !storedState || state !== storedState) {
return new Response(null, {
status: 400,
});
return new Response(
JSON.stringify({
status_text: "Something is wrong",
data: { code, state, storedState },
}),
{
status: 400,
},
);
}
try {
@ -70,9 +76,15 @@ export async function GET(request: Request): Promise<Response> {
// the specific error message depends on the provider
if (e instanceof OAuth2RequestError) {
// invalid code
return new Response(null, {
status: 400,
});
return new Response(
JSON.stringify({
status_text: "Invalid code",
error: JSON.stringify(e),
}),
{
status: 400,
},
);
}
return new Response(null, {
status: 500,