fix login error + auth callback

This commit is contained in:
Gabriel Matte 2024-10-18 18:16:24 -04:00
parent ddc33bb6ac
commit d7986447c4
3 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,5 @@
process.env['base']
import ReactDOM from 'react-dom/client';
import App from './App.tsx';

View file

@ -44,7 +44,7 @@ class AuthManager{
async login(userInfo,req,res,next){
const tokenToSave = jwt.create(userInfo.email, userInfo._id);
res.redirect(`/auth/callback?user=${tokenToSave}`);
res.redirect(`${process.env['FRONTEND_URL']}/auth/callback?user=${tokenToSave}`);
console.info(`L'utilisateur '${userInfo.name}' vient de se connecter`)
}

View file

@ -54,7 +54,9 @@ class SimpleAuth{
self.authmanager.login(user,req,res,next)
}
catch (error) {
return next(error);
return res.status(400).json({
message: error.message
});
}
}