Yes, you can add custom logic to the Provider's authorize function or implement one of next-auth's callbacks depending on what you're trying to achieve.
authorize
Might also be worth reading this guide from Magic's docs.
Hey Nick. I signed up for Magic.link with the link provided but only got 1k MAUs instead of 3k ;(
You need to use this import 'next-auth/react' instead of 'next-auth/client' on the signin.tsx page.
Also, there appears to be all sorts of typescript issues. Resolved below:
const magic = new Magic(process.env.MAGIC_SK) const session: any = { jwt: true } export default NextAuth({ session: session, providers: [ Credentials({ name: 'Magic Link', credentials: { didToken: { label: 'DID Token', type: 'text' }, }, async authorize({ didToken: didToken }, req: any) { // validate magic DID token magic.token.validate(didToken) // fetch user metadata const metadata = await magic.users.getMetadataByToken(didToken) // return user info return { ...metadata } as any }, }), ], pages: { // override signIn page so we can integrate with Magic signIn: '/auth/signin', }, })
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes, you can add custom logic to the Provider's
authorize
function or implement one of next-auth's callbacks depending on what you're trying to achieve.Might also be worth reading this guide from Magic's docs.
Hey Nick. I signed up for Magic.link with the link provided but only got 1k MAUs instead of 3k ;(
You need to use this import 'next-auth/react' instead of 'next-auth/client' on the signin.tsx page.
Also, there appears to be all sorts of typescript issues. Resolved below: