Class TokenRequestBuilder
- Namespace
- Autodesk.Authentication.Authentication.V2.Token
- Assembly
- Autodesk.Authentication.dll
Builds and executes requests for operations under \authentication\v2\token
public class TokenRequestBuilder : BaseRequestBuilder
- Inheritance
-
BaseRequestBuilderTokenRequestBuilder
- Inherited Members
-
BaseRequestBuilder.PathParametersBaseRequestBuilder.RequestAdapterBaseRequestBuilder.UrlTemplate
Constructors
TokenRequestBuilder(Dictionary<string, object>, IRequestAdapter)
Instantiates a new TokenRequestBuilder and sets the default values.
public TokenRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter)
Parameters
pathParameters
Dictionary<string, object>Path parameters for the request
requestAdapter
IRequestAdapterThe request adapter to use to execute the requests.
TokenRequestBuilder(string, IRequestAdapter)
Instantiates a new TokenRequestBuilder and sets the default values.
public TokenRequestBuilder(string rawUrl, IRequestAdapter requestAdapter)
Parameters
rawUrl
stringThe raw URL to use for the request builder.
requestAdapter
IRequestAdapterThe request adapter to use to execute the requests.
Methods
PostAsync(TokenPostRequestBody, Action<RequestConfiguration<DefaultQueryParameters>>?, CancellationToken)
Token endpoint returns access token and refresh token, depending on the request parameters.The endpoint requires Basic Authorization for confidential clients. For public clients, the Authorization Header should not be in the header and client_id
should be included in the form body.* If grant_type
is authorization_code
, it returns 3-legged access token for authorization code grant. * If grant_type
is client_credentials
, it returns 2-legged access token for client credentials grant.* If grant_type
is refresh_token
, it returns new access token by using the refresh token provided in the request.
public Task<AuthToken?> PostAsync(TokenPostRequestBody body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = null, CancellationToken cancellationToken = default)
Parameters
body
TokenPostRequestBodyThe request body
requestConfiguration
Action<RequestConfiguration<DefaultQueryParameters>>Configuration for the request such as headers, query parameters, and middleware options.
cancellationToken
CancellationTokenCancellation token to use when cancelling requests
Returns
Exceptions
- AuthToken400Error
When receiving a 400 status code
- Error
When receiving a 401 status code
- Error
When receiving a 429 status code
ToPostRequestInformation(TokenPostRequestBody, Action<RequestConfiguration<DefaultQueryParameters>>?)
Token endpoint returns access token and refresh token, depending on the request parameters.The endpoint requires Basic Authorization for confidential clients. For public clients, the Authorization Header should not be in the header and client_id
should be included in the form body.* If grant_type
is authorization_code
, it returns 3-legged access token for authorization code grant. * If grant_type
is client_credentials
, it returns 2-legged access token for client credentials grant.* If grant_type
is refresh_token
, it returns new access token by using the refresh token provided in the request.
public RequestInformation ToPostRequestInformation(TokenPostRequestBody body, Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = null)
Parameters
body
TokenPostRequestBodyThe request body
requestConfiguration
Action<RequestConfiguration<DefaultQueryParameters>>Configuration for the request such as headers, query parameters, and middleware options.
Returns
- RequestInformation
A Microsoft.Kiota.Abstractions.RequestInformation
WithUrl(string)
Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
public TokenRequestBuilder WithUrl(string rawUrl)
Parameters
rawUrl
stringThe raw URL to use for the request builder.