Skip to content

Commit 509e52a

Browse files
committed
Error handling for Apple
1 parent 54e716b commit 509e52a

File tree

1 file changed

+8
-2
lines changed
  • src/app/(landing)/oauth-callback/apple

1 file changed

+8
-2
lines changed

src/app/(landing)/oauth-callback/apple/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ function OAuthProcessCallback() {
2525
if (fragment) {
2626
const params = new URLSearchParams(fragment.slice(1)) // Remove the "#" and parse parameters
2727
const token = params.get("id_token")
28-
if (token) {
29-
setStoredToken(token) // Store token if available
28+
if (!token) {
29+
const msg = "Invalid redirect parameters"
30+
router.push(`/?error=${encodeURIComponent(msg)}`)
31+
return
3032
}
33+
setStoredToken(token) // Store token if available
34+
} else {
35+
const msg = "Invalid redirect parameters"
36+
router.push(`/?error=${encodeURIComponent(msg)}`)
3137
}
3238
}, [searchParams])
3339

0 commit comments

Comments
 (0)