From 417b694bc988d8b63352732e8e742790ba53eafe Mon Sep 17 00:00:00 2001 From: mstrhakr <37352843+mstrhakr@users.noreply.github.com> Date: Sun, 4 Sep 2022 20:31:07 -0400 Subject: [PATCH 1/2] fix scope add check to see if scope contains 'openid' before adding it to params --- lib/strategy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/strategy.js b/lib/strategy.js index ad8bf99..cb0ea7a 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -291,8 +291,10 @@ Strategy.prototype.authenticate = function(req, options) { if (callbackURL) { params.redirect_uri = callbackURL; } var scope = options.scope || this._scope; if (scope) { - if (Array.isArray(scope)) { scope = scope.join(' '); } - params.scope = 'openid ' + scope; + if (Array.isArray(scope)) { + if (!scope.includes('openid')) { scope.unshift('openid'); } + params.scope = scope.join(' '); + } } else { params.scope = 'openid'; } From db8ebe5e54b5a6e164d5704aa6e481341f3fed53 Mon Sep 17 00:00:00 2001 From: mstrhakr <37352843+mstrhakr@users.noreply.github.com> Date: Wed, 7 Sep 2022 13:26:36 -0400 Subject: [PATCH 2/2] add check if string --- lib/strategy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/strategy.js b/lib/strategy.js index cb0ea7a..1619fab 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -291,6 +291,7 @@ Strategy.prototype.authenticate = function(req, options) { if (callbackURL) { params.redirect_uri = callbackURL; } var scope = options.scope || this._scope; if (scope) { + if (typeof scope == 'string'){ scope = scope.split(' ') } if (Array.isArray(scope)) { if (!scope.includes('openid')) { scope.unshift('openid'); } params.scope = scope.join(' ');