We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b538ac1 commit 1c5ef5bCopy full SHA for 1c5ef5b
src/middleware.ts
@@ -12,6 +12,15 @@ const authMiddleware = withAuth(
12
function onSuccess(_req) {
13
// you can get a token from the request object(req.nextauth.token) and do something with it
14
// In here, do any kind of logging or tracking here or redirect to a custom URL
15
+ },
16
+ {
17
+ callbacks: {
18
+ authorized: async ({ token }) => {
19
+ // If a user is authenticated, the token will be present
20
+ // and the user is authorized.
21
+ return !!token?.id;
22
23
24
}
25
);
26
0 commit comments