#next-auth
1 messages · Page 1 of 1 (latest)
Based on the information provided in the extracts, it seems like you're trying to use a callback named authorized in your NextAuth configuration. However, according to the NextAuth documentation and examples provided in the extracts, there is no authorized callback available.
The available callbacks in NextAuth are:
signIn: This is called when a user signs in.redirect: This is called when redirecting to a different URL.session: This is called whenever a session is checked.jwt: This is called when decoding or encoding the JWT token.
If you're trying to check if a user is authenticated, you might want to use the signIn callback instead. Here's an example based on the extracts:
callbacks: {
async signIn({ user, account, profile, email, credentials }) {
return true; // If there is a user, the user is authenticated
},
},
Please refer to the NextAuth documentation (https://next-auth.js.org/configuration/callbacks) for more details on how to use callbacks.
Sources:
- Github Issue (closed): next-auth CredentialsProvider for Next.js 13.4 not working with external backend > Original post Part 4 (https://github.com/vercel/next.js/issues/52701)
- Vercel > Guides > How to Build a Fullstack App with Next.js, Prisma, and Vercel Postgres > Step 6. Set up GitHub authentication with NextAuth Part 5 (https://vercel.com/guides/nextjs-prisma-postgres)
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@north stream kapa.ai is still learning and improving, please let us know how it did by reacting below
@deft cargo they redirected me to the signin page
Let me check the knowledge base for you. One moment! :books:
Based on the information provided in the extracts, it seems like you're being redirected to the sign-in page. This is likely due to the configuration of your NextAuth setup.
In NextAuth, you can specify the sign-in page using the pages option in the NextAuth configuration. For example:
pages: {
signIn: '/signin',
},
This configuration will redirect unauthenticated users to the /signin page.
If you want to change the page to which users are redirected, you can modify the signIn property in the pages option.
For more information on how to configure NextAuth, you can refer to the NextAuth documentation (https://next-auth.js.org/configuration/pages).
Sources:
- Github Issue (closed): next-auth CredentialsProvider for Next.js 13.4 not working with external backend > Original post Part 4 (https://github.com/vercel/next.js/issues/52701)
- Vercel > Guides > How to Build a Fullstack App with Next.js, Prisma, and Vercel Postgres > Step 6. Set up GitHub authentication with NextAuth Part 5 (https://vercel.com/guides/nextjs-prisma-postgres)