mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🔧 chore: Update OpenIDStrategy Logging (#2911)
This commit is contained in:
parent
e0402b71f0
commit
a6058c5669
1 changed files with 26 additions and 2 deletions
|
|
@ -85,10 +85,21 @@ async function setupOpenId() {
|
||||||
},
|
},
|
||||||
async (tokenset, userinfo, done) => {
|
async (tokenset, userinfo, done) => {
|
||||||
try {
|
try {
|
||||||
|
logger.info(`[openidStrategy] verify login openidId: ${userinfo.sub}`);
|
||||||
|
logger.debug('[openidStrategy] very login tokenset and userinfo', { tokenset, userinfo });
|
||||||
|
|
||||||
let user = await User.findOne({ openidId: userinfo.sub });
|
let user = await User.findOne({ openidId: userinfo.sub });
|
||||||
|
logger.info(
|
||||||
|
`[openidStrategy] user ${user ? 'found' : 'not found'} with openidId: ${userinfo.sub}`,
|
||||||
|
);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
user = await User.findOne({ email: userinfo.email });
|
user = await User.findOne({ email: userinfo.email });
|
||||||
|
logger.info(
|
||||||
|
`[openidStrategy] user ${user ? 'found' : 'not found'} with email: ${
|
||||||
|
userinfo.email
|
||||||
|
} for openidId: ${userinfo.sub}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let fullName = '';
|
let fullName = '';
|
||||||
|
|
@ -120,8 +131,8 @@ async function setupOpenId() {
|
||||||
}, decodedToken);
|
}, decodedToken);
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
console.error(
|
logger.error(
|
||||||
`Key '${requiredRoleParameterPath}' not found in ${requiredRoleTokenKind} token!`,
|
`[openidStrategy] Key '${requiredRoleParameterPath}' not found in ${requiredRoleTokenKind} token!`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,8 +194,21 @@ async function setupOpenId() {
|
||||||
|
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
`[openidStrategy] login success openidId: ${user.openidId} username: ${user.username} email: ${user.email}`,
|
||||||
|
{
|
||||||
|
user: {
|
||||||
|
openidId: user.openidId,
|
||||||
|
username: user.username,
|
||||||
|
email: user.email,
|
||||||
|
name: user.name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
done(null, user);
|
done(null, user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
logger.error('[openidStrategy] login failed', err);
|
||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue