Auth Provider

Generate Authorisation Token to call Affinidi Services.

Install Dependency

Package: AffinidiTdk.AuthProvider

dotnet add package AffinidiTdk.AuthProvider

You can check the latest version of this module on the nuget.org repository or view the source code at the GitHub repository.

API Endpoints

URLs required to initiate integration with Affinidi TDK.

Token Endpoint

Endpoint to generate access token to call Affinidi Services with TDK.

https://apse1.auth.developer.affinidi.io/auth/oauth2/token

API Gateway URL

Base API URL of Affinidi Services.

https://apse1.api.affinidi.io

Classes and Methods

AuthProvider API

Used to generate Project Scoped Token required for calling Affinidi services (Clients).

When initiating the AuthProvider class, provide the Token information including the public/private key information to generate the Authorisation Token required.

Required Parameters

  • tokenId: ID of the Personal Access Token (PAT).
  • privateKey: Private key string to use to sign the token.
  • projectId: Project ID to generate the Token.
  • passphrase: Passphrase of the Private key if configured.
Example
using AffinidiTdk.AuthProvider;
var authProvider = new AuthProvider(new AuthProviderParams { // NOTE: set your variables for PAT TokenId = "<PAT_ID>", PrivateKey = "<PAT_PRIVATE_KEY_STRING>", ProjectId = "<PROJECT_ID>" Passphrase = "<PAT_KEY_PAIR_PASSPHRASE>", });

FetchProjectScopedTokenAsync

Return the generated Project Scoped Token to use for calling the Affinidi Services.

Parameters

No Parameters Required

Example
using AffinidiTdk.AuthProvider;
using AffinidiTdk.AuthProvider; var authProvider = new AuthProvider(new AuthProviderParams { TokenId = "<PAT_ID>", PrivateKey = "<PAT_PRIVATE_KEY_STRING>", ProjectId = "<PROJECT_ID>" Passphrase = "<PAT_KEY_PAIR_PASSPHRASE>", }); var projectScopedToken = await authProvider.FetchProjectScopedTokenAsync();