Skip to content

Commit 08ee7b2

Browse files
rishabhpoddarRishabhbalazsorban44
authored
Updates supertokens example app SSR behaviour (vercel#43218)
Co-authored-by: Rishabh <[email protected]> Co-authored-by: Balázs Orbán <[email protected]>
1 parent 807c59a commit 08ee7b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: examples/with-supertokens/pages/index.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@ export async function getServerSideProps(context) {
1616
supertokensNode.init(backendConfig())
1717
let session
1818
try {
19-
session = await Session.getSession(context.req, context.res)
19+
session = await Session.getSession(context.req, context.res, {
20+
overrideGlobalClaimValidators: async function () {
21+
return []
22+
},
23+
})
2024
} catch (err) {
2125
if (err.type === Session.Error.TRY_REFRESH_TOKEN) {
2226
return { props: { fromSupertokens: 'needs-refresh' } }
2327
} else if (err.type === Session.Error.UNAUTHORISED) {
2428
// this will force the frontend to try and refresh which will fail
2529
// clearing all cookies and redirecting the user to the login screen.
2630
return { props: { fromSupertokens: 'needs-refresh' } }
27-
} else if (err.type === Session.Error.INVALID_CLAIMS) {
28-
return { props: {} }
29-
} else {
30-
throw err
3131
}
32+
throw err
3233
}
3334

3435
return {

0 commit comments

Comments
 (0)