Only incuding state when was given

This commit is contained in:
Fabian Stamm 2020-03-25 23:48:42 +01:00
parent 21f4e741f2
commit 7071e64f6d

View File

@ -97,7 +97,7 @@ const GetAuthRoute = (view = false) =>
} = req.query; } = req.query;
const sendError = type => { const sendError = type => {
if (redirect_uri === "$local") redirect_uri = "/code"; if (redirect_uri === "$local") redirect_uri = "/code";
res.redirect((redirect_uri += `?error=${type}&state=${state}`)); res.redirect((redirect_uri += `?error=${type}${state ? "&state=" + state : ""}`));
}; };
const scopes = scope.split(";"); const scopes = scope.split(";");
@ -228,7 +228,7 @@ const GetAuthRoute = (view = false) =>
let redir = let redir =
client.redirect_url === "$local" ? "/code" : client.redirect_url; client.redirect_url === "$local" ? "/code" : client.redirect_url;
let ruri = redir + `?code=${code.code}&state=${state}`; let ruri = redir + `?code=${code.code}${state ? "&state=" + state : ""}`;
if (nored === "true") { if (nored === "true") {
res.json({ res.json({
redirect_uri: ruri redirect_uri: ruri