Search code examples
c#asp.netoauthaccess-tokenidentityserver4

how to get access token via identityserver4 via method (not api)?


You can get a token by making a request for the token (as per example below).

But how do you get a (client credential) access token from within identityserver class (without requesting it via http POST web service api)? is there an identityserver4 method to use to obtain an access token?


http://docs.identityserver.io/en/release/endpoints/token.html

POST /connect/token

client_id=client1&
client_secret=secret&
grant_type=authorization_code&
code=hdh922&
redirect_uri=https://myapp.com/callback

Solution

  • Yes you can use the IssueJwtAsync or IssueClientJwtAsync methods from the IdentityServerTools class to do exactly that.

    As per documentation.