Connecting to OpenID Connect server programmatically to retrieve JWT claims

Viewed 37

I've asked this question about doing a similar thing with SAML tokens. I only point to this question so you understand what I am looking for. In simple words - WebAPI-to-WebAPI authentication. Something like this

Here I am trying to achieve the same thing with OpenID Connect. Bottom line, I want to supply the credentials to the OpenId Authentication server and retrieve a token, which I can then parse and get claims out of it. All in code.

I see a lot of this kind stuff

https://accounts.google.com/o/oauth2/v2/auth?
  response_type=code&
  client_id=424911365001.apps.googleusercontent.com&
  scope=openid%20email&
  redirect_uri=https%3A//oauth2.example.com/code&
  state=security_token%3D138r5719ru3e1%26url%3Dhttps%3A%2F%2Foauth2-login-demo.example.com%2FmyHome&
  login_hint=jsmith@example.com&
  nonce=0394852-3190485-2490358&
  hd=example.com

But I am not getting, how to logon any given user programmatically?

1 Answers

There's a different flow called client credentials flow that allows one service to get a token to use against an API. But this only supposed to be used for machine-to-machine communication and in this flow there is no user involved

https://identity.tn-data.se/authorize?grant_type=client_credentials
&client_id=1234567
&client_secret=XXXXXXX
&scope=payment.readonly
Related