Token Endpoint
The token endpoint can be used to programmatically request tokens.
Duende IdentityServer supports a subset of the OpenID Connect and OAuth 2.0 token request parameters. For a full list, see here.
Required Parameters
Section titled “Required Parameters”-
client_idclient identifier; not necessary in body if it is present in the authorization header
-
grant_type-
authorization_code -
client_credentials -
password -
refresh_token -
urn:ietf:params:oauth:grant-type:device_code -
extension grant
-
Optional Parameters
Section titled “Optional Parameters”-
client_secretclient secret for confidential/credentials clients - either in the post body, or as a basic authentication header.
-
scopeone or more registered scopes. If not specified, a token for all explicitly allowed scopes will be issued.
-
redirect_urirequired for the
authorization_codegrant type -
codethe authorization code (required for
authorization_codegrant type) -
code_verifierPKCE proof key
-
usernameresource owner username (required for
passwordgrant type) -
passwordresource owner password (required for
passwordgrant type) -
acr_valuesallows passing in additional authentication related information. Duende IdentityServer special cases the following proprietary acr_values
-
tenant:name_of_tenantcan be used to pass a tenant name to the token endpoint
-
-
refresh_tokenthe refresh token (required for
refresh_tokengrant type) -
device_codethe device code (required for
urn:ietf:params:oauth:grant-type:device_codegrant type) -
auth_req_idthe backchannel authentication request id (required for
urn:openid:params:grant-type:cibagrant type)
POST /connect/tokenCONTENT-TYPE application/x-www-form-urlencoded
client_id=client1& client_secret=secret& grant_type=authorization_code& code=hdh922& redirect_uri=https://myapp.com/callback.NET Client Library
Section titled “.NET Client Library”You can use the Duende IdentityModel client library to programmatically interact with the protocol endpoint from .NET code.
using Duende.IdentityModel.Client;
var client = new HttpClient();
var response = await client.RequestAuthorizationCodeTokenAsync(new AuthorizationCodeTokenRequest{ Address = TokenEndpoint,
ClientId = "client", ClientSecret = "secret",
Code = "...", CodeVerifier = "...", RedirectUri = "https://app.com/callback"});