added better oauth error message

This commit is contained in:
Zai Shi 2024-07-26 10:16:43 -07:00 committed by Stan Wohlwend
parent 8d65f9b47b
commit 8243386459

View File

@ -45,7 +45,7 @@ export const GET = createSmartRouteHandler({
cookies().delete("stack-oauth-inner-" + query.state);
if (cookieInfo?.value !== 'true') {
throw new StatusError(StatusError.BadRequest, "stack-oauth-inner-<xyz> cookie not found");
throw new StatusError(StatusError.BadRequest, "OAuth cookie not found. This is likely because you have refreshed the page during the OAuth sign in process. Please try to sign in again");
}
const outerInfoDB = await prismaClient.oAuthOuterInfo.findUnique({
@ -55,7 +55,7 @@ export const GET = createSmartRouteHandler({
});
if (!outerInfoDB) {
throw new StatusError(StatusError.BadRequest, "Invalid stack-oauth-inner-<xyz> cookie value. Please try signing in again.");
throw new StatusError(StatusError.BadRequest, "Invalid OAuth cookie. Please try to signing in again.");
}
let outerInfo: Awaited<ReturnType<typeof oauthCookieSchema.validate>>;