jaredhanson / passport-openidconnect

OpenID Connect authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-openidconnect/?utm_source=github&utm_medium=referral&utm_campaign=passport-openidconnect&utm_content=about
MIT License
188 stars 173 forks source link

oidc discovery well-known #80

Open salleman33 opened 4 years ago

salleman33 commented 4 years ago

Hi, I looked to configure oidc auth with discovery/dynamic config. I have the URL https://xxxxx/sp/.well-known/openid-configuration for that.

Here is my test :

const OidcStrategy = require('passport-openidconnect').Strategy;
passport.use('oidc', new OidcStrategy({
  issuer: "https://xxxxxx/sp",
  clientID: 'xxxx',
  clientSecret: 'xxxx',
  callbackURL: 'https://localhost:3000/authorization-code/callback',
  scope: 'openid profile'
}, (issuer, sub, profile, accessToken, refreshToken, done) => {
        console.log(profile);
  return done(null, profile);
}));

But this error occured :

TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
    at validateString (internal/validators.js:117:11)
    at Url.parse (url.js:159:3)
    at Object.urlParse [as parse] (url.js:154:13)
    at new Strategy (/tmp/myapp/node_modules/passport-openidconnect/lib/strategy.js:40:60)
    at Object.<anonymous> (/tmp/myapp/app.js:21:22)

Do you have an idea or a working example ?

Thanks

jonathangaldino commented 4 years ago

I went through the same issue. You have to mention the userInfoURL as well.

sorokya commented 2 years ago

Well the maintainer totally removed discovery so I guess this can be closed. I'll be using openid-client to do discovery and feed the config into OpenIdConnectStrategy 🤷‍♂️