Table of Contents

Class CredentialsClient

Namespace
Auth0.ManagementApi.Clients
Assembly
Auth0.ManagementApi.dll
public class CredentialsClient : ICredentialsClient
Inheritance
CredentialsClient
Implements
Inherited Members
Extension Methods

Methods

CreateAsync(string, PostClientCredentialRequestContent, RequestOptions?, CancellationToken)

Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests.

Public Key

Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests.

Sample:

{
  "credential_type": "public_key",
  "name": "string",
  "pem": "string",
  "alg": "RS256",
  "parse_expiry_from_cert": false,
  "expires_at": "2022-12-31T23:59:59Z"
}

Certificate (CA-signed & self-signed)

Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN.

CA-signed Certificate Sample (pem):

{
  "credential_type": "x509_cert",
  "name": "string",
  "pem": "string"
}

CA-signed Certificate Sample (subject_dn):

{
  "credential_type": "cert_subject_dn",
  "name": "string",
  "subject_dn": "string"
}

Self-signed Certificate Sample:

{
  "credential_type": "cert_subject_dn",
  "name": "string",
  "pem": "string"
}

The credential will be created but not yet enabled for use until you set the corresponding properties in the client:

public WithRawResponseTask<PostClientCredentialResponseContent> CreateAsync(string clientId, PostClientCredentialRequestContent request, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

clientId string
request PostClientCredentialRequestContent
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<PostClientCredentialResponseContent>

Examples

await client.Clients.Credentials.CreateAsync(
    "client_id",
    new PostClientCredentialRequestContent { CredentialType = ClientCredentialTypeEnum.PublicKey }
);

DeleteAsync(string, string, RequestOptions?, CancellationToken)

Delete a client credential you previously created. May be enabled or disabled. For more information, read Client Credential Flow.

public WithRawResponseTask DeleteAsync(string clientId, string credentialId, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

clientId string
credentialId string
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask

Examples

await client.Clients.Credentials.DeleteAsync("client_id", "credential_id");

GetAsync(string, string, RequestOptions?, CancellationToken)

Get the details of a client credential.

Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client.

public WithRawResponseTask<GetClientCredentialResponseContent> GetAsync(string clientId, string credentialId, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

clientId string
credentialId string
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<GetClientCredentialResponseContent>

Examples

await client.Clients.Credentials.GetAsync("client_id", "credential_id");

ListAsync(string, RequestOptions?, CancellationToken)

Get the details of a client credential.

Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client.

public WithRawResponseTask<IEnumerable<ClientCredential>> ListAsync(string clientId, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

clientId string
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<IEnumerable<ClientCredential>>

Examples

await client.Clients.Credentials.ListAsync("client_id");

UpdateAsync(string, string, PatchClientCredentialRequestContent, RequestOptions?, CancellationToken)

Change a client credential you previously created. May be enabled or disabled. For more information, read Client Credential Flow.

public WithRawResponseTask<PatchClientCredentialResponseContent> UpdateAsync(string clientId, string credentialId, PatchClientCredentialRequestContent request, RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

clientId string
credentialId string
request PatchClientCredentialRequestContent
options RequestOptions
cancellationToken CancellationToken

Returns

WithRawResponseTask<PatchClientCredentialResponseContent>

Examples

await client.Clients.Credentials.UpdateAsync(
    "client_id",
    "credential_id",
    new PatchClientCredentialRequestContent()
);