-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.js
More file actions
36 lines (33 loc) · 1.15 KB
/
Copy pathauth.js
File metadata and controls
36 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import NextAuth from "next-auth";
import LinkedIn from "next-auth/providers/linkedin";
import Hubspot from "next-auth/providers/hubspot";
// import mongoosePromise from "@/utils/mongoose-connect";
// import Profile from "./model/Profile";
// import { MongoDBAdapter } from "@auth/mongodb-adapter";
// import clientPromise from "@/utils/database";
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [LinkedIn, Hubspot],
// adapter: MongoDBAdapter(clientPromise),
callbacks: {
async signIn({ user, account, profile, email, credentials }) {
try {
// await mongoosePromise;
// const existingUser = await Profile.find({ userId: user.id });
// if (!existingUser.length) {
// const newProfile = new Profile({
// userId: user.id,
// name: user.name || undefined,
// image: user.image || undefined,
// accountEmail: user.email || undefined,
// });
// await newProfile.save();
// }
} catch (err) {
console.error('SIGN IN ERROR')
console.log(err);
} finally {
return true;
}
},
},
});