diff --git a/index.js b/index.js index 5448b93..b45c2dc 100644 --- a/index.js +++ b/index.js @@ -22,6 +22,8 @@ app.use( ); app.use(morgan("combined")); +const removeNullValues = (obj) => Object.entries(obj).reduce((a,[k,v]) => (v ? (a[k]=v, a) : a), {}) + const getMcpClient = async () => { const mcpIssuer = await Issuer.discover(process.env.MCP_PROVIDER); @@ -79,12 +81,12 @@ const getAuthorizationControllerFactory = (extraParams) => { req.session.state = state; req.session.nonce = nonce; - const redirectUrl = client.authorizationUrl({ + const redirectUrl = client.authorizationUrl(removeNullValues({ nonce, state, ...AUTHORIZATION_DEFAULT_PARAMS, ...extraParams, - }); + })); res.redirect(redirectUrl); } catch (e) { diff --git a/views/index.ejs b/views/index.ejs index b5edf6c..8a21f86 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -96,7 +96,16 @@ cols="50" rows="12" ><%= locals.defaultParamsValue %> -
+

+ La liste des paramètres utilisables est disponible dans la + + librairie oidc-client + . +