Update auth.js

This commit is contained in:
Yûki Vachot 2021-06-06 14:48:04 +02:00
parent 438f478541
commit 4ecd7867b0

View file

@ -4,10 +4,10 @@ function getSession (req, callback) {
if(typeof req.headers.cookie !== 'undefined'){ if(typeof req.headers.cookie !== 'undefined'){
request.post({ request.post({
headers: {'content-type' : 'application/x-www-form-urlencoded'}, headers: {'content-type' : 'application/x-www-form-urlencoded'},
url: 'http://127.0.0.1:3000/verify:token', url: 'http://service-authentication:3000/verify:token',
body: 'sessionid='+req.headers.cookie.replace('SESSIONID=','') body: 'sessionid='+req.headers.cookie.replace('SESSIONID=','')
},function (error, response, body) { },function (error, response, body) {
console.log("body ; getSession auth private :",body); //console.log("body ; getSession auth private :",body);
if(typeof body !== 'undefined'){ if(typeof body !== 'undefined'){
const bodyJson = JSON.parse(body); const bodyJson = JSON.parse(body);
if (bodyJson && bodyJson.status && bodyJson.data) { if (bodyJson && bodyJson.status && bodyJson.data) {