Table of Contents

Class AccessTokenClient

Namespace
Nfield.SDK
Assembly
Nfield.Public.SDK.dll
public class AccessTokenClient
Inheritance
AccessTokenClient
Inherited Members

Constructors

AccessTokenClient(string, HttpClient)

public AccessTokenClient(string baseUrl, HttpClient httpClient)

Parameters

baseUrl string
httpClient HttpClient

Properties

BaseUrl

public string BaseUrl { get; set; }

Property Value

string

JsonSerializerSettings

protected JsonSerializerSettings JsonSerializerSettings { get; }

Property Value

JsonSerializerSettings

ReadResponseAsString

public bool ReadResponseAsString { get; set; }

Property Value

bool

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

model TokenRequestModel
cancellationToken CancellationToken

A 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

model TokenRefreshRequestModel
cancellationToken CancellationToken

A 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

response HttpResponseMessage
headers IReadOnlyDictionary<string, IEnumerable<string>>
cancellationToken CancellationToken

Returns

Task<AccessTokenClient.ObjectResponseResult<T>>

Type Parameters

T