Skip to content

Commit 08e6ceb

Browse files
authoredNov 28, 2022
updates with-supertokens example (vercel#43379)
Prevents infinite redirect loop if someone is logged in and visits a route like `/auth/random`
1 parent 013844c commit 08e6ceb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎examples/with-supertokens/pages/auth/[[...path]].tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ import React, { useEffect } from 'react'
33
import styles from '../../styles/Home.module.css'
44
import dynamic from 'next/dynamic'
55
import SuperTokens from 'supertokens-auth-react'
6-
import { redirectToAuth } from 'supertokens-auth-react/recipe/thirdpartyemailpassword'
6+
import { redirectToAuth } from 'supertokens-auth-react'
77

88
const SuperTokensComponentNoSSR = dynamic(
9-
new Promise((res) => res(SuperTokens.getRoutingComponent)),
9+
new Promise((res) => res(SuperTokens.getRoutingComponent)) as any,
1010
{ ssr: false }
1111
)
1212

1313
export default function Auth(): JSX.Element {
1414
useEffect(() => {
1515
if (SuperTokens.canHandleRoute() === false) {
16-
redirectToAuth()
16+
redirectToAuth({
17+
redirectBack: false,
18+
})
1719
}
1820
}, [])
1921

0 commit comments

Comments
 (0)
Please sign in to comment.