Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler
2021-09-20 08:55:41 +02:00
3 changed files with 15 additions and 9 deletions
@@ -30,12 +30,12 @@ export class AuthenticateController extends BaseController {
console.warn("/message request was aborted");
});
const { nonce, state, playUri } = parse(req.getQuery());
if (!state || !nonce) {
res.writeStatus("400 Unauthorized").end("missing state and nonce URL parameters");
return;
}
try {
const { nonce, state, playUri } = parse(req.getQuery());
if (!state || !nonce) {
throw "missing state and nonce URL parameters";
}
const loginUri = await openIDClient.authorizationUrl(
state as string,
nonce as string,
@@ -45,6 +45,7 @@ export class AuthenticateController extends BaseController {
res.writeHeader("Location", loginUri);
return res.end();
} catch (e) {
console.error("openIDLogin => e", e);
return this.errorToResponse(e, res);
}
});
@@ -85,6 +86,7 @@ export class AuthenticateController extends BaseController {
this.addCorsHeaders(res);
return res.end(JSON.stringify({ authToken: authToken, username: userInfo.username, userUuid : sub }));
} catch (e) {
console.error("openIDCallback => ERROR", e);
return this.errorToResponse(e, res);
}
});
@@ -155,6 +157,7 @@ export class AuthenticateController extends BaseController {
})
);
} catch (e) {
console.error("register => ERROR", e);
this.errorToResponse(e, res);
}
})();
@@ -231,6 +234,7 @@ export class AuthenticateController extends BaseController {
}
}
} catch (error) {
console.error("profileCallback => ERROR", error);
this.errorToResponse(error, res);
}
});