Click or drag to resize

HoarderServiceClientGetToken Method

Converts an API Key into a JWT (JSON Web Token).

Namespace: Orthogonal.Hoarder.StdLib
Assembly: Orthogonal.Hoarder.StdLib (in Orthogonal.Hoarder.StdLib.dll) Version: 8.0.17
Syntax
C#
public Task<string> GetToken(
	string apiKey
)

Parameters

apiKey  String
The API Key that will be converted into a JWT containing the assigned roles.

Return Value

TaskString
A string representing an encoded JSON Web Token.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown if apiKey is null.
Remarks

Client applications with an API Key can use this endpoint to convert the key into a JWT (JSON Web Token) which contains the authorisation roles assigned to the key. The JWT is then placed into the headers of subsequent requests to allow elevation of permissions to view unredacted data and perform update or management operations. The HoarderServiceClient class has a Token property which correctly manages the placement of the JWT in the HTTP client's request headers.

An unrecognised API Key will return a JWT with no roles, in which case no data updates are allowed and information will be redacted from some responses.

Note that this web service does not technically need to use JWTs, and it only does so as a technical exercise. It could use simple authorisation rules based upon putting the API Key in a custom request header, as is common for web services that don't need complex rules for identity and roles.

See Also