Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorizationURL required? #14

Open
ajmas opened this issue Mar 31, 2021 · 1 comment
Open

authorizationURL required? #14

ajmas opened this issue Mar 31, 2021 · 1 comment

Comments

@ajmas
Copy link

ajmas commented Mar 31, 2021

Looking at the example in the README, no indication of needing authorizationURL is provided, but I get (truncated):

 Error: authorizationURL is required
    at /Users/ajmas/Development/myproject/node_modules/@exlinc/keycloak-passport/index.js:16:13
    at Array.forEach (<anonymous>)
    at new Strategy (/Users/ajmas/Development/myproject/node_modules/@exlinc/keycloak-passport/index.js:14:5)
    at Object.initPassport (/Users/ajmas/Development/myproject/src/middleware/passport.ts:234:18)

Looking at the source of this package, I see the following:

  [
    'host',
    'realm',
    'clientID',
    'clientSecret',
    'callbackURL',
    'authorizationURL',
    'tokenURL',
    'userInfoURL'
  ].forEach((k) => {
    if (!options[k]) {
      throw new Error(`${k} is required`);
    }
  });

Which suggests it is required, but then I see configuration.js which resolves the missing URLs, but I am not sure how it is to be used to resolve this issue?

@Navjot-Sharma
Copy link

I know it's a bit late but for future reference for anyone else, it can be used like this

`
import KeycloakEnvConfig from "@exlinc/keycloak-passport/configuration.js";

const config = new KeycloakEnvConfig({
host: '',
realm: '',
clientID: '',
clientSecret: '',
callbackURL: '',
});

console.log('keycloak config', config);

// Register the strategy with passport

passport.use(
"keycloak",
new KeycloakStrategy(config, (accessToken, refreshToken, profile, done) => {});`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants