mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 10:29:17 +00:00
added proper error handling for user creation
This commit is contained in:
@@ -77,6 +77,7 @@ const initializePassport = async () => {
|
|||||||
profile: any,
|
profile: any,
|
||||||
cb: any
|
cb: any
|
||||||
) => {
|
) => {
|
||||||
|
try {
|
||||||
const email = profile.emails[0].value;
|
const email = profile.emails[0].value;
|
||||||
let user = await User.findOne({
|
let user = await User.findOne({
|
||||||
authProvider: AuthProvider.GOOGLE,
|
authProvider: AuthProvider.GOOGLE,
|
||||||
@@ -104,6 +105,9 @@ const initializePassport = async () => {
|
|||||||
|
|
||||||
req.providerAuthToken = providerAuthToken;
|
req.providerAuthToken = providerAuthToken;
|
||||||
cb(null, profile);
|
cb(null, profile);
|
||||||
|
} catch (err) {
|
||||||
|
cb(err);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user