Skip to content

Commit a000f4c

Browse files
Merge pull request #504 from Decatur-Robotics/conform-auth-adapter-to-mongo-adapter
Conform auth adapter to Mongo adapter
2 parents e6d1bae + cee908f commit a000f4c

File tree

11 files changed

+275
-640
lines changed

11 files changed

+275
-640
lines changed

lib/Auth.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,11 @@ export const AuthenticationOptions: AuthOptions = {
2727
clientId: process.env.GOOGLE_ID,
2828
clientSecret: process.env.GOOGLE_SECRET,
2929
allowDangerousEmailAccountLinking: true,
30-
profile: async (profile) => {
31-
logger.debug("Google profile:", profile);
32-
33-
const existingUser = await (
34-
await cachedDb
35-
).findObject(CollectionId.Users, { email: profile.email });
36-
if (existingUser) {
37-
existingUser.id = profile.sub;
38-
return existingUser;
39-
}
40-
41-
const user = new User(
42-
profile.name,
43-
profile.email,
44-
profile.picture,
45-
false,
46-
await GenerateSlug(await cachedDb, CollectionId.Users, profile.name),
47-
[],
48-
[],
49-
);
50-
51-
user.id = profile.sub;
52-
53-
return user;
54-
},
5530
}),
5631
SlackProvider({
5732
clientId: process.env.NEXT_PUBLIC_SLACK_CLIENT_ID as string,
5833
clientSecret: process.env.SLACK_CLIENT_SECRET as string,
5934
allowDangerousEmailAccountLinking: true,
60-
profile: async (profile) => {
61-
logger.debug("Slack profile:", profile);
62-
63-
const existing = await (
64-
await cachedDb
65-
).findObject(CollectionId.Users, { email: profile.email });
66-
67-
if (existing) {
68-
existing.slackId = profile.sub;
69-
existing.id = profile.sub;
70-
console.log("Found existing user:", existing);
71-
return existing;
72-
}
73-
74-
const user = new User(
75-
profile.name,
76-
profile.email,
77-
profile.picture,
78-
false,
79-
await GenerateSlug(await cachedDb, CollectionId.Users, profile.name),
80-
[],
81-
[],
82-
profile.sub,
83-
10,
84-
1,
85-
);
86-
87-
user.id = profile.sub;
88-
89-
return user;
90-
},
9135
}),
9236
Email({
9337
server: {

0 commit comments

Comments
 (0)