2

I am trying to get a Bearer token using IdentityModel2 - https://github.com/IdentityModel/IdentityModel2

Their github page says it support resource owner password

enter image description here

But I cannot see any way to add username/password and no example on how to do this.

How do I get token with username and password using TokenClient?

Community
  • 1
  • 1
Guerrilla
  • 13,375
  • 31
  • 109
  • 210

1 Answers1

5

Answer was simple, I just had missed the right method. I will add here instead of deleting incase someone else stumbles across this:

var client = new TokenClient(
    _identityEndpoints.TokenEndpoint,
    "client", "secret", AuthenticationStyle.PostValues);

var response = await client.RequestResourceOwnerPasswordAsync(user, pass, "scope");
var token = response.AccessToken;
Guerrilla
  • 13,375
  • 31
  • 109
  • 210