MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / signIn

Function signIn

Video 131/app/api/auth/[...nextauth]/route.js:39–53  ·  view source on GitHub ↗
({ user, account, profile, email, credentials })

Source from the content-addressed store, hash-verified

37 ],
38 callbacks: {
39 async signIn({ user, account, profile, email, credentials }) {
40 if(account.provider == "github") {
41 await connectDb()
42 // Check if the user already exists in the database
43 const currentUser = await User.findOne({email: email})
44 if(!currentUser){
45 // Create a new user
46 const newUser = await User.create({
47 email: user.email,
48 username: user.email.split("@")[0],
49 })
50 }
51 return true
52 }
53 },
54
55 async session({ session, user, token }) {
56 const dbUser = await User.findOne({email: session.user.email})

Callers 1

page.jsFile · 0.85

Calls 1

connectDbFunction · 0.85

Tested by

no test coverage detected