update docker image + error messages on auth callback
This commit is contained in:
parent
682a6b0b18
commit
ff77d013eb
BIN
packages/reservation-platform/docker/myp-rp_latest.tar.xz
(Stored with Git LFS)
BIN
packages/reservation-platform/docker/myp-rp_latest.tar.xz
(Stored with Git LFS)
Binary file not shown.
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user