Rollback to a1d67c74
This commit is contained in:
@@ -44,20 +44,7 @@ export function registerOAuthRoutes(app: Express) {
|
||||
const cookieOptions = getSessionCookieOptions(req);
|
||||
res.cookie(COOKIE_NAME, sessionToken, { ...cookieOptions, maxAge: ONE_YEAR_MS });
|
||||
|
||||
// Décoder le state pour obtenir l'URL de redirection
|
||||
let redirectUrl = "/";
|
||||
try {
|
||||
redirectUrl = Buffer.from(state, 'base64').toString('utf-8');
|
||||
// Si c'est une URL complète, extraire seulement le path
|
||||
if (redirectUrl.startsWith('http')) {
|
||||
const url = new URL(redirectUrl);
|
||||
redirectUrl = url.pathname;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("[OAuth] Failed to decode state, redirecting to /", error);
|
||||
}
|
||||
|
||||
res.redirect(302, redirectUrl);
|
||||
res.redirect(302, "/");
|
||||
} catch (error) {
|
||||
console.error("[OAuth] Callback failed", error);
|
||||
res.status(500).json({ error: "OAuth callback failed" });
|
||||
|
||||
Reference in New Issue
Block a user