From 7071e64f6d3ae66c3bb229467ad6feff35b8347d Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 25 Mar 2020 23:48:42 +0100 Subject: [PATCH] Only incuding state when was given --- src/api/oauth/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/oauth/auth.ts b/src/api/oauth/auth.ts index 52e9ec7..d8370f0 100644 --- a/src/api/oauth/auth.ts +++ b/src/api/oauth/auth.ts @@ -97,7 +97,7 @@ const GetAuthRoute = (view = false) => } = req.query; const sendError = type => { 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(";"); @@ -228,7 +228,7 @@ const GetAuthRoute = (view = false) => let redir = 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") { res.json({ redirect_uri: ruri