Skip to content

Commit 15e228b

Browse files
author
Paul Asjes
committed
Added error page on callback error
1 parent 58c2bd8 commit 15e228b

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"@radix-ui/react-icons": "^1.3.0",
1213
"@radix-ui/themes": "^2.0.1",
1314
"@workos-inc/node": "^5.0.0",
1415
"jose": "^5.1.1",

src/app/callback/error/page.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"use client";
2+
3+
import { Text, Heading, Flex, Box, Callout, Container } from "@radix-ui/themes";
4+
5+
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
6+
7+
export default function ErrorPage() {
8+
return (
9+
<>
10+
<Flex direction="column" gap="2" mb="7" align="center">
11+
<Box pl="9" pr="9">
12+
<Heading size="8" align="left">
13+
Error
14+
</Heading>
15+
<Container pt="4">
16+
<Callout.Root color="red" role="alert">
17+
<Callout.Icon>
18+
<ExclamationTriangleIcon />
19+
</Callout.Icon>
20+
<Callout.Text>Something went wrong</Callout.Text>
21+
</Callout.Root>
22+
</Container>
23+
<Container pt="4">
24+
<Text size="3" align="center" color="gray">
25+
Couldn’t sign in. If you are not sure what happened, please
26+
contact your organization admin.
27+
</Text>
28+
</Container>
29+
</Box>
30+
</Flex>
31+
</>
32+
);
33+
}

src/app/callback/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,5 @@ export async function GET(request: NextRequest) {
5151
}
5252
}
5353

54-
return NextResponse.json({
55-
error: "No authorization code was received from AuthKit",
56-
});
54+
return NextResponse.redirect(new URL("/callback/error", request.url));
5755
}

0 commit comments

Comments
 (0)