Created
March 22, 2023 11:55
-
-
Save shakibhasan09/c37eb67910a992f881e722313531b2fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const authOptions: AuthOptions = { | |
providers: [ | |
CredentialsProvider({ | |
type: "credentials", | |
credentials: {}, | |
async authorize(credentials) { | |
const { email_address, password } = credentials as any; | |
const user: any = await prisma.user.findFirst({ | |
where: { | |
AND: [ | |
{ email_address: email_address }, | |
{ password: createHash("sha3-256").update(password).digest("hex") }, | |
], | |
}, | |
}); | |
if (!user) return null; | |
return user; | |
}, | |
}), | |
], | |
callbacks: { | |
async jwt({ token, user }) { | |
return { ...token, ...user }; | |
}, | |
async session({ session, token }: { session: Session; token: any }) { | |
return { ...session, user: token }; | |
}, | |
}, | |
session: { | |
strategy: "jwt", | |
}, | |
pages: { | |
signIn: "/signin", | |
signOut: "/signout", | |
newUser: "/signup", | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment