mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-25 20:58:50 +01:00
🔧 feat: Implement custom logout redirect handling and enhance OpenID auto-redirect logic
This commit is contained in:
parent
a2f953460b
commit
17b0f35f93
6 changed files with 82 additions and 127 deletions
|
|
@ -22,13 +22,6 @@ const oauthHandler = async (req, res) => {
|
|||
return;
|
||||
}
|
||||
await setAuthTokens(req.user._id, res);
|
||||
|
||||
// On successful login, let's clear any openid redirect flags
|
||||
res.cookie('successful_login', 'true', {
|
||||
maxAge: 1000, // very short-lived, just for client-side detection
|
||||
httpOnly: false // client needs to read this
|
||||
});
|
||||
|
||||
res.redirect(domains.client);
|
||||
} catch (err) {
|
||||
logger.error('Error in setting authentication tokens:', err);
|
||||
|
|
@ -38,9 +31,9 @@ const oauthHandler = async (req, res) => {
|
|||
router.get('/error', (req, res) => {
|
||||
// A single error message is pushed by passport when authentication fails.
|
||||
logger.error('Error in OAuth authentication:', { message: req.session.messages.pop() });
|
||||
|
||||
|
||||
// Redirect to login page with auth_failed parameter to prevent infinite redirect loops
|
||||
res.redirect(`${domains.client}/login?auth_failed=true`);
|
||||
res.redirect(`${domains.client}/login?redirect=false`);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue