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

How to access ID Token? #143

Open
zachsa opened this issue Aug 19, 2021 · 3 comments
Open

How to access ID Token? #143

zachsa opened this issue Aug 19, 2021 · 3 comments

Comments

@zachsa
Copy link

zachsa commented Aug 19, 2021

When requesting the openid scope, how does one get the ID token back?

My understanding is that the callback passed to the strategy constructor is passed these params:

accessToken, refreshToken, profile, cb

But documentation for Hydra makes me think there should also be an ID token passed in some cases: https://www.ory.sh/hydra/docs/concepts/openid-connect-oidc/

@pommelinho
Copy link

pommelinho commented Aug 24, 2021

Actually this is possible, you can pass a function with 5 instead of 4 params


async function userAuthenticationByOAuthKeyCloakStrategy(
  accessToken,
  refreshToken,
  params,
  profile,
  done,
) {

you can then access params.id_token

@zachsa
Copy link
Author

zachsa commented Aug 24, 2021

I didn't know that - and I don't think it was documented? I changed to a different library: openid-client. There's a nice example getting it to work with passport: https://codeburst.io/how-to-implement-openid-authentication-with-openid-client-and-passport-in-node-js-43d020121e87

@pommelinho
Copy link

Hey,

no I also did not found it in the doc. Searched for it in the code ;-)

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