Class AccessTokenClient
public class AccessTokenClient
- Inheritance
-
AccessTokenClient
- Inherited Members
Constructors
AccessTokenClient(string, HttpClient)
public AccessTokenClient(string baseUrl, HttpClient httpClient)
Parameters
baseUrlstringhttpClientHttpClient
Properties
BaseUrl
public string BaseUrl { get; set; }
Property Value
JsonSerializerSettings
protected JsonSerializerSettings JsonSerializerSettings { get; }
Property Value
- JsonSerializerSettings
ReadResponseAsString
public bool ReadResponseAsString { get; set; }
Property Value
Methods
PostAsync(TokenRequestModel, CancellationToken)
Obtain a Bearer token from the user and password credentials
This JWT that should be supplied as a 'Bearer' Authorization header for further requests.
public virtual Task<TokenResponseModel> PostAsync(TokenRequestModel model, CancellationToken cancellationToken = default)
Parameters
modelTokenRequestModelcancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<TokenResponseModel>
Successful
Exceptions
- NfieldSdkException
A server side error occurred.
PostTokenRefreshAsync(TokenRefreshRequestModel, CancellationToken)
🔒 DPoP REQUIRED - Refreshes the access token using a refresh token.
public virtual Task<TokenResponseModel> PostTokenRefreshAsync(TokenRefreshRequestModel model, CancellationToken cancellationToken = default)
Parameters
modelTokenRefreshRequestModelcancellationTokenCancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<TokenResponseModel>
Successful
Exceptions
- NfieldSdkException
A server side error occurred.
ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)
protected virtual Task<AccessTokenClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
Parameters
responseHttpResponseMessageheadersIReadOnlyDictionary<string, IEnumerable<string>>cancellationTokenCancellationToken
Returns
Type Parameters
T