### Install Auth0.AuthenticationApi Package
Source: https://github.com/auth0/auth0.net/blob/master/README.md
Use this command to install the Auth0.AuthenticationApi NuGet package.
```powershell
Install-Package Auth0.AuthenticationApi
```
--------------------------------
### Create Client Credential (Public Key - JSON Example)
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Example JSON payload for creating a 'public_key' client credential. Includes fields for type, name, PEM, algorithm, and expiry.
```json
{
"credential_type": "public_key",
"name": "string",
"pem": "string",
"alg": "RS256",
"parse_expiry_from_cert": false,
"expires_at": "2022-12-31T23:59:59Z"
}
```
--------------------------------
### Restore Project Dependencies
Source: https://github.com/auth0/auth0.net/blob/master/CONTRIBUTING.md
Use this command to install all necessary project dependencies before building or testing.
```bash
dotnet restore
```
--------------------------------
### Install Auth0.ManagementApi Package
Source: https://github.com/auth0/auth0.net/blob/master/README.md
Use this command to install the Auth0.ManagementApi NuGet package for your .NET project.
```powershell
Install-Package Auth0.ManagementApi
```
--------------------------------
### Make an API Call to Get Auth0 Connections
Source: https://github.com/auth0/auth0.net/blob/master/README.md
Example of making an API call to retrieve all Auth0 (database) connections using the ManagementApiClient.
```csharp
await client.Connections.GetAllAsync("auth0");
```
--------------------------------
### Get Directory Provisioning Configuration
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific directory provisioning configuration for a given connection ID. Use this to inspect the details of a single provisioning setup.
```csharp
await client.Connections.DirectoryProvisioning.GetAsync("id");
```
--------------------------------
### Restore and Build Auth0.NET
Source: https://github.com/auth0/auth0.net/blob/master/DEVELOPMENT.md
Use these commands to restore project dependencies and build the library. Ensure the .NET Core SDK is installed.
```bash
dotnet restore
dotnet build
```
--------------------------------
### List SCIM Configurations
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve a list of SCIM configurations for a tenant. Use this to get an overview of all SCIM configurations.
```csharp
await client.Connections.ScimConfiguration.ListAsync(
new ListScimConfigurationsRequestParameters { From = "from", Take = 1 }
);
```
--------------------------------
### Get Supplemental Signals Async
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Get the supplemental signals configuration for a tenant. This method does not require any parameters.
```csharp
await client.SupplementalSignals.GetAsync();
```
--------------------------------
### List Prompt Render Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves render setting configurations for all screens. Use this to get a paginated list of all available render settings.
```csharp
await client.Prompts.Rendering.ListAsync(
new ListAculsRequestParameters
{
Fields = "fields",
IncludeFields = true,
Page = 1,
PerPage = 1,
IncludeTotals = true,
Prompt = "prompt",
Screen = "screen",
RenderingMode = AculRenderingModeEnum.Advanced,
}
);
```
--------------------------------
### Update Log Stream Request Example
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
This is a general example of how to initiate an update for a log stream using the Auth0 .NET SDK. The 'id' parameter is required. Note that updating the sink is not permitted for 'eventbridge' and 'eventgrid' types.
```csharp
await client.LogStreams.UpdateAsync("id", new UpdateLogStreamRequestContent());
```
--------------------------------
### List Directory Provisioning Configurations
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a paginated list of directory provisioning configurations for a tenant. Use this to get an overview of all configured directory provisionings.
```csharp
await client.Connections.DirectoryProvisioning.ListAsync(
new ListDirectoryProvisioningsRequestParameters { From = "from", Take = 1 }
);
```
--------------------------------
### Get Tenant Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve tenant settings. Optionally specify fields to include or exclude.
```csharp
await client.Tenants.Settings.GetAsync(
new GetTenantSettingsRequestParameters { Fields = "fields", IncludeFields = true }
);
```
--------------------------------
### SupplementalSignals.GetAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Get the supplemental signals configuration for a tenant.
```APIDOC
## SupplementalSignals.GetAsync
### Description
Get the supplemental signals configuration for a tenant.
### Method
GET
### Endpoint
/api/v2/tenant/supplemental-signals
### Response
#### Success Response (200)
- **akamai_enabled** (boolean) - Indicates if Akamai is enabled.
- **signal_disabled_on** (string) - The date when signals were disabled.
```
--------------------------------
### Get Prompt Partials
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves template partials for a specific prompt. Use this to fetch existing prompt configurations.
```csharp
await client.Prompts.Partials.GetAsync(PartialGroupsEnum.Login);
```
--------------------------------
### Get Prompt Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves details of the Universal Login configuration for your tenant, including Identifier First Authentication and WebAuthn with Device Biometrics for MFA features.
```APIDOC
## Get Prompt Settings
### Description
Retrieves details of the Universal Login configuration of your tenant. This includes the Identifier First Authentication and WebAuthn with Device Biometrics for MFA features.
### Method
GET
### Endpoint
/api/v2/prompts/settings
### Response
#### Success Response (200)
- **settings** (object) - The Universal Login configuration settings.
#### Response Example
```json
{
"example": "GetSettingsResponseContent"
}
```
```
--------------------------------
### Auth0 Management API NuGet Package Reference (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Example of how to reference the Auth0.ManagementApi NuGet package in version 8.
```xml
```
--------------------------------
### Use Ip Device Binding (v9)
Source: https://github.com/auth0/auth0.net/blob/master/V9_MIGRATION_GUIDE.md
Example demonstrating the use of the 'Ip' value for device binding in v9. The 'Asn' value has been removed.
```csharp
// Asn is no longer available; only Ip remains
var binding = ClientSessionTransferDelegationDeviceBindingEnum.Ip;
```
--------------------------------
### Auth0 Management API NuGet Package Reference (v7)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Example of how to reference the Auth0.ManagementApi NuGet package in version 7.
```xml
```
--------------------------------
### ListAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Get render setting configurations for all screens. Allows filtering by fields, inclusion of fields, pagination, and specific prompts, screens, or rendering modes.
```APIDOC
## ListAsync
### Description
Get render setting configurations for all screens.
### Method
GET
### Endpoint
/api/v2/prompts/rendering
### Parameters
#### Query Parameters
- **fields** (string) - Optional - Comma-separated list of fields to include in the response.
- **include_fields** (boolean) - Optional - Whether to include the specified fields.
- **page** (integer) - Optional - The page number to retrieve.
- **per_page** (integer) - Optional - The number of items per page.
- **include_totals** (boolean) - Optional - Whether to include the total count of items.
- **prompt** (string) - Optional - Filter by prompt name.
- **screen** (string) - Optional - Filter by screen name.
- **rendering_mode** (string) - Optional - Filter by rendering mode (e.g., 'advanced').
```
--------------------------------
### Client Initialization (v7 vs v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Compares client initialization between v7 (manual token) and v8 (automatic token management with ManagementClient).
```csharp
// Old (v7)
var token = await GetAccessTokenAsync();
var client = new ManagementApiClient(token, new Uri("https://YOUR_DOMAIN/api/v2"));
// New (v8) - Recommended with automatic token management
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_DOMAIN",
TokenProvider = new ClientCredentialsTokenProvider(
domain: "YOUR_DOMAIN",
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET"
)
});
```
--------------------------------
### Client/Application Management: Creating a Client (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Illustrates how to create a new client application in v8 using `CreateClientRequestContent` and `client.Clients.CreateAsync`.
```APIDOC
## POST /api/v2/clients
### Description
Creates a new client application.
### Method
POST
### Endpoint
/api/v2/clients
### Request Body
- **Name** (string) - Required - The name of the client application.
- **AppType** (ClientAppTypeEnum) - Required - The type of the application (e.g., Spa).
- **Callbacks** (string[]) - Optional - A list of valid callback URLs for the application.
### Request Example
```csharp
var request = new CreateClientRequestContent
{
Name = "My Application",
AppType = ClientAppTypeEnum.Spa,
Callbacks = new[] { "https://myapp.com/callback" }
};
CreateClientResponseContent app = await client.Clients.CreateAsync(request);
```
### Response
#### Success Response (200)
- **ClientId** (string) - The unique identifier for the created client.
```
--------------------------------
### GetAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Get the render settings for a specific screen within a prompt. This allows retrieval of detailed configuration for a single prompt-screen combination.
```APIDOC
## GetAsync
### Description
Get render settings for a specific screen.
### Method
GET
### Endpoint
/api/v2/prompts/rendering/{prompt}/{screen}
### Parameters
#### Path Parameters
- **prompt** (string) - Required - Name of the prompt (e.g., 'login').
- **screen** (string) - Required - Name of the screen (e.g., 'login').
```
--------------------------------
### Get Universal Login Branding Template
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the current Universal Login branding template. No specific setup is required beyond having an authenticated client instance.
```csharp
await client.Branding.Templates.GetUniversalLoginAsync();
```
--------------------------------
### Auth0 Management Client Initialization (v8 - Automatic Token Management)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Demonstrates the recommended v8 approach using ManagementClient for automatic token acquisition and refresh via client credentials.
```csharp
using Auth0.ManagementApi;
// Automatic token acquisition and refresh via client credentials
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_DOMAIN",
TokenProvider = new ClientCredentialsTokenProvider(
domain: "YOUR_DOMAIN",
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET")
});
```
--------------------------------
### v7 Method Signatures for User Operations
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Shows the method signatures for creating, getting, and listing users in v7, highlighting parameter structures and return types.
```csharp
// Create user
Task CreateAsync(UserCreateRequest request, CancellationToken cancellationToken = default);
// Get user
Task GetAsync(string id, string fields = null, bool includeFields = true,
CancellationToken cancellationToken = default);
// List users (with separate pagination parameter)
Task> GetAllAsync(GetUsersRequest request, PaginationInfo pagination = null,
CancellationToken cancellationToken = default);
```
--------------------------------
### Get SNS Push Notification Provider Configuration
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve the current configuration details for the AWS SNS push notification provider. This is helpful for auditing or understanding the current setup.
```csharp
await client.Guardian.Factors.PushNotification.GetSnsProviderAsync();
```
--------------------------------
### Retrieve Phone Factor Templates
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Use this method to get the current multi-factor authentication enrollment and verification templates for phone factors. No specific setup is required beyond having an authenticated client instance.
```csharp
await client.Guardian.Factors.Phone.GetTemplatesAsync();
```
--------------------------------
### User Management: Creating a User (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Demonstrates how to create a new user in v8 using the `CreateUserRequestContent` object and the `client.Users.CreateAsync` method.
```APIDOC
## POST /api/v2/users
### Description
Creates a new user in Auth0.
### Method
POST
### Endpoint
/api/v2/users
### Request Body
- **Email** (string) - Required - The email address of the user.
- **Connection** (string) - Required - The connection to use for the user.
- **Password** (string) - Optional - The user's password.
- **EmailVerified** (boolean) - Optional - Whether the user's email has been verified.
### Request Example
```csharp
var request = new CreateUserRequestContent
{
Email = "newuser@example.com",
Connection = "Username-Password-Authentication",
Password = "SecureP@ssw0rd!",
EmailVerified = true
};
var user = await client.Users.CreateAsync(request);
```
### Response
#### Success Response (200)
- **UserId** (string) - The unique identifier for the created user.
```
--------------------------------
### Auth0 Management Client Initialization (v8 - Custom Token Provider)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Shows how to implement and use a custom ITokenProvider for alternative token acquisition strategies in v8.
```csharp
using Auth0.ManagementApi;
// Or implement ITokenProvider for any other strategy
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_DOMAIN",
TokenProvider = new MyCustomTokenProvider()
});
```
--------------------------------
### Build the Project
Source: https://github.com/auth0/auth0.net/blob/master/CONTRIBUTING.md
Compile the entire project to ensure all components are built successfully.
```bash
dotnet build
```
--------------------------------
### Auth0 Management Client Initialization (v8 - Pre-obtained Token)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Shows how to initialize ManagementApiClient in v8 using a pre-obtained access token.
```csharp
using Auth0.ManagementApi;
// Use a pre-obtained access token directly — no wrapper needed
var client = new ManagementApiClient(
token: "YOUR_ACCESS_TOKEN",
clientOptions: new ClientOptions { BaseUrl = "https://YOUR_DOMAIN/api/v2" });
```
--------------------------------
### Get Flows Vault Connection by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific Flows Vault Connection using its ID. Use this to get details of an existing connection.
```csharp
await client.Flows.Vault.Connections.GetAsync("id");
```
--------------------------------
### Initialize ManagementClient with Options
Source: https://github.com/auth0/auth0.net/blob/master/docs-source/index.md
Initialize the ManagementClient with your Auth0 domain, client ID, and client secret. Tokens are automatically managed.
```csharp
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_AUTH0_DOMAIN",
ClientId = "YOUR_CLIENT_ID",
ClientSecret = "YOUR_CLIENT_SECRET"
});
// Tokens are automatically acquired and refreshed
var users = await client.Users.ListAsync(new ListUsersRequestParameters());
```
--------------------------------
### Create Client: v7 vs v8
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Compares the C# code for creating a client application in Auth0 .NET SDK v7 and v8. Key differences include request object naming and enum types for application type.
```csharp
var request = new ClientCreateRequest
{
Name = "My Application",
ApplicationType = ClientApplicationType.Spa,
Callbacks = new List { "https://myapp.com/callback" }
};
Client app = await client.Clients.CreateAsync(request);
```
```csharp
var request = new CreateClientRequestContent
{
Name = "My Application",
AppType = ClientAppTypeEnum.Spa,
Callbacks = new[] { "https://myapp.com/callback" }
};
CreateClientResponseContent app = await client.Clients.CreateAsync(request);
```
--------------------------------
### Captcha.GetAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Get the CAPTCHA configuration for your client.
```APIDOC
## GetCaptchaConfiguration
### Description
Get the CAPTCHA configuration for your client.
### Method
GET
### Endpoint
/api/v2/attack-protection/ தcaptcha
### Parameters
None
### Response
#### Success Response (200)
- **settings** (object) - The CAPTCHA configuration settings.
### Response Example
```json
{
"enabled": true,
"friendly_challenge_enabled": false,
"turnstile_protection_enabled": true
}
```
```
--------------------------------
### Get Specific Prompt Render Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the render settings for a specific prompt and screen combination. Use this to view the current configuration for a particular screen.
```csharp
await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNameEnum.Login);
```
--------------------------------
### client.RiskAssessments.Settings.NewDevice.GetAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Gets the risk assessment settings for the new device assessor.
```APIDOC
## Get Risk Assessment Settings for New Device
### Description
Retrieves the current risk assessment settings specifically for the new device assessor.
### Method
GET
### Endpoint
/api/v2/risk-assessment/settings/new-device
### Parameters
None
### Response
#### Success Response (200)
- **remember_for** (integer) - The duration in days for which new device assessments are remembered.
### Response Example
```json
{
"remember_for": 30
}
```
```
--------------------------------
### Manual Pagination (v7)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Demonstrates manual pagination using IPagedList in v7. Requires manual fetching of subsequent pages.
```csharp
var request = new GetUsersRequest { Query = "email:*@example.com" };
var pagination = new PaginationInfo(pageNo: 0, perPage: 50, includeTotals: true);
IPagedList users = await client.Users.GetAllAsync(request, pagination);
int totalUsers = users.Paging.Total; // Total count available directly
foreach (var user in users)
{
Console.WriteLine(user.Email);
}
// Manual next-page fetch
var nextPage = new PaginationInfo(pageNo: 1, perPage: 50, includeTotals: true);
IPagedList page2 = await client.Users.GetAllAsync(request, nextPage);
```
--------------------------------
### Get Organization Connection
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific connection associated with an organization.
```APIDOC
## Get Organization Connection
### Description
Retrieves a specific connection associated with an organization.
### Method
GET
### Endpoint
/api/v2/organizations/{id}/connections/{connectionId}
### Parameters
#### Path Parameters
- **id** (string) - Required - Organization identifier.
- **connectionId** (string) - Required - Connection identifier.
```
--------------------------------
### Get Refresh Token Information
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve refresh token information by its ID.
```csharp
await client.RefreshTokens.GetAsync("id");
```
--------------------------------
### Connection Management: Creating a Connection (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Details how to create a new connection in v8 using `CreateConnectionRequestContent` and `client.Connections.CreateAsync`.
```APIDOC
## POST /api/v2/connections
### Description
Creates a new connection.
### Method
POST
### Endpoint
/api/v2/connections
### Request Body
- **Name** (string) - Required - The name of the connection.
- **Strategy** (ConnectionIdentityProviderEnum) - Required - The identity provider strategy for the connection (e.g., Auth0).
### Request Example
```csharp
var request = new CreateConnectionRequestContent
{
Name = "my-database",
Strategy = ConnectionIdentityProviderEnum.Auth0
};
CreateConnectionResponseContent connection = await client.Connections.CreateAsync(request);
```
### Response
#### Success Response (200)
- **Id** (string) - The unique identifier for the created connection.
```
--------------------------------
### Auth0 Management API Client Initialization (v7)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Illustrates manual token management required for initializing the ManagementApiClient in v7.
```csharp
using Auth0.ManagementApi;
// Required manual token management
var token = await GetAccessTokenAsync(); // Your token acquisition logic
var client = new ManagementApiClient(token, new Uri("https://YOUR_DOMAIN/api/v2"));
```
--------------------------------
### Get Role by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves details about a specific user role specified by ID.
```csharp
await client.Roles.GetAsync("id");
```
--------------------------------
### Auth0 Management Client Initialization (v8 - Delegate Token Provider)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Illustrates using a DelegateTokenProvider for custom token retrieval in v8, such as from a secret manager.
```csharp
using Auth0.ManagementApi;
// Or retrieve tokens asynchronously (e.g., from a secret manager) via ManagementClient
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_DOMAIN",
TokenProvider = new DelegateTokenProvider(ct => secretManager.GetSecretAsync("auth0-token", ct))
});
```
--------------------------------
### Initialize ManagementApiClient with an Existing Token
Source: https://github.com/auth0/auth0.net/blob/master/README.md
Use this client if you manage token acquisition and refreshing yourself. Ensure the token has the necessary permissions.
```csharp
var client = new ManagementApiClient(
token: "your-access-token",
clientOptions: new ClientOptions { BaseUrl = "https://YOUR_AUTH0_DOMAIN/api/v2" });
```
--------------------------------
### Get Phone Template by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific phone template using its unique identifier.
```csharp
await client.Branding.Phone.Templates.GetAsync("id");
```
--------------------------------
### Initialize ManagementClient with Static Token
Source: https://github.com/auth0/auth0.net/blob/master/docs-source/index.md
Initialize the ManagementClient using a pre-obtained static access token.
```csharp
// With a static token
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_AUTH0_DOMAIN",
Token = "your-access-token"
});
```
--------------------------------
### Get Self-Service Profile by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific self-service profile using its unique identifier.
```csharp
await client.SelfServiceProfiles.GetAsync("id");
```
--------------------------------
### Get Network ACL
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific access control list entry for your client by its ID.
```APIDOC
## Get Network ACL
### Description
Get a specific access control list entry for your client.
### Method
GET
### Endpoint
/network-acls/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - The ID of the access control list to retrieve.
### Response
#### Success Response (200)
- **id** (string) - The ID of the ACL entry.
- **Description** (string) - The description of the ACL entry.
- **Active** (boolean) - Whether the ACL entry is active.
- **Rule** (object) - The rule associated with the ACL entry.
- **Action** (object) - The action taken.
- **Scope** (string) - The scope of the rule.
```
--------------------------------
### Get Network ACL by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific access control list entry by its ID.
```csharp
await client.NetworkAcls.GetAsync("id");
```
--------------------------------
### Retrieve CAPTCHA Configuration
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Gets the CAPTCHA configuration for your client. Use this to view current CAPTCHA settings.
```csharp
await client.AttackProtection.Captcha.GetAsync();
```
--------------------------------
### client.Keys.Signing.ListAsync()
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve details of all the application signing keys associated with your tenant.
```APIDOC
## ListAsync
### Description
Retrieve details of all the application signing keys associated with your tenant.
### Method
GET
### Endpoint
/keys/signing
### Parameters
#### Query Parameters
None
### Request Example
```csharp
await client.Keys.Signing.ListAsync();
```
### Response
#### Success Response (200)
- **signingKeys** (IEnumerable) - A list of signing keys.
#### Response Example
```json
{
"signingKeys": [
{
"kid": "string",
"x5c": ["string"],
"alg": "string",
"use": "string",
"kty": "string"
}
]
}
```
```
--------------------------------
### Organize User Operations with Sub-clients (v7 vs v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
v8 introduces hierarchical sub-clients for better organization of related resources, such as user permissions, roles, logs, and organizations. This contrasts with v7's flat client structure.
```csharp
var permissions = await client.Users.GetPermissionsAsync("user_id");
var roles = await client.Users.GetRolesAsync("user_id");
var logs = await client.Users.GetLogsAsync("user_id");
var organizations = await client.Users.GetAllOrganizationsAsync("user_id");
```
```csharp
var permissions = await client.Users.Permissions.ListAsync("user_id", new ListUserPermissionsRequestParameters());
var roles = await client.Users.Roles.ListAsync("user_id", new ListUserRolesRequestParameters());
var logs = await client.Users.Logs.ListAsync("user_id", new ListUserLogsRequestParameters());
var organizations = await client.Users.Organizations.ListAsync("user_id", new ListUserOrganizationsRequestParameters());
```
--------------------------------
### Get Specific Action Version
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific version of an action. Action versions are immutable once created.
```csharp
await client.Actions.Versions.GetAsync("actionId", "id");
```
--------------------------------
### Get User Attribute Profile Template
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific User Attribute Profile Template by its ID.
```csharp
await client.UserAttributeProfiles.GetTemplateAsync("id");
```
--------------------------------
### User Management: Listing Users (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Shows how to list users in v8 using `ListUsersRequestParameters` and the `client.Users.ListAsync` method, including pagination and total count retrieval.
```APIDOC
## GET /api/v2/users
### Description
Retrieves a list of users, with support for filtering, pagination, and sorting.
### Method
GET
### Endpoint
/api/v2/users
### Parameters
#### Query Parameters
- **SearchEngine** (SearchEngineVersionsEnum) - Optional - Specifies the search engine version to use (e.g., V3).
- **Q** (string) - Optional - The query to search for users.
- **PerPage** (int) - Optional - The number of users to return per page.
- **IncludeTotals** (boolean) - Optional - Whether to include the total count of users in the response.
### Request Example
```csharp
var request = new ListUsersRequestParameters
{
SearchEngine = SearchEngineVersionsEnum.V3,
Q = "email:*@example.com",
PerPage = 50,
IncludeTotals = true
};
var pager = await client.Users.ListAsync(request);
```
### Response
#### Success Response (200)
- **Items** (array) - A list of user objects.
- **Total** (int) - The total number of users matching the query (if `IncludeTotals` is true).
#### Response Example
```csharp
// Access total count
var firstPageResponse = (ListUsersOffsetPaginatedResponseContent?)pager.CurrentPage.Response;
var totalUsers = firstPageResponse?.Total;
// Iterate through all users
await foreach (var user in pager)
{
Console.WriteLine(user.Email);
}
```
```
--------------------------------
### Get Tenant's Default Custom Domain
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve the tenant's default custom domain.
```csharp
await client.CustomDomains.GetDefaultAsync();
```
--------------------------------
### Create HTTP Log Stream in C#
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Example of creating an HTTP log stream using the Auth0 .NET SDK. Ensure the necessary client and request types are imported.
```csharp
await client.LogStreams.CreateAsync(
new CreateLogStreamHttpRequestBody
{
Type = LogStreamHttpEnum.Http,
Sink = new LogStreamHttpSink { HttpEndpoint = "httpEndpoint" },
}
);
```
--------------------------------
### Get Organization Connection
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves details of a specific connection associated with an organization. Requires both the organization and connection identifiers.
```csharp
await client.Organizations.Connections.GetAsync("id", "connection_id");
```
--------------------------------
### Release Auth0.NET Package
Source: https://github.com/auth0/auth0.net/blob/master/DEVELOPMENT.md
Build a release version of the Auth0.NET library. This process requires Windows and involves npm commands for versioning, pushing to a release branch, and uploading to NuGet.
```bash
npm run release 7.3.0
```
```bash
nuget push
```
--------------------------------
### Initialize ManagementClient with Client Credentials
Source: https://github.com/auth0/auth0.net/blob/master/README.md
Recommended for server-to-server applications. This client automatically acquires and refreshes tokens using client credentials.
```csharp
var client = new ManagementClient(new ManagementClientOptions
{
Domain = "YOUR_AUTH0_DOMAIN",
TokenProvider = new ClientCredentialsTokenProvider(
domain: "YOUR_AUTH0_DOMAIN",
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET"
)
});
// Tokens are automatically acquired and refreshed
var users = await client.Users.GetAllAsync();
```
--------------------------------
### Get Encryption Key by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve detailed information for a specific encryption key using its unique ID.
```csharp
await client.Keys.Encryption.GetAsync("kid");
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a directory provisioning configuration for a given connection. This method allows setting up new provisioning configurations.
```APIDOC
## CreateAsync
### Description
Create a directory provisioning configuration for a connection.
### Method
POST
### Endpoint
/api/v2/connections/{id}/provisioning
### Parameters
#### Path Parameters
- **id** (string) - Required - The id of the connection to create its directory provisioning configuration.
#### Request Body
- **request** (CreateDirectoryProvisioningRequestContent) - Optional - The content for the new directory provisioning configuration.
### Request Example
```csharp
await client.Connections.DirectoryProvisioning.CreateAsync(
"id",
new CreateDirectoryProvisioningRequestContent()
);
```
### Response
#### Success Response (200)
- **directory_provisioning** (object) - The newly created directory provisioning configuration details.
```
--------------------------------
### User Creation API Call (v7 vs v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Shows the difference in creating a user between v7 (UserCreateRequest) and v8 (CreateUserRequestContent).
```csharp
// Old (v7)
var request = new UserCreateRequest
{
Email = "test@example.com",
Connection = "Username-Password-Authentication"
};
User created = await client.Users.CreateAsync(request);
// New (v8)
var request = new CreateUserRequestContent
{
Email = "test@example.com",
Connection = "Username-Password-Authentication"
};
CreateUserResponseContent created = await client.Users.CreateAsync(request);
```
--------------------------------
### Get Client Credential
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the details of a specific client credential using its ID and the client's ID.
```APIDOC
## Get Client Credential
### Description
Retrieves the details of a specific client credential.
### Method
GET (Assumed based on 'GetAsync' naming convention)
### Endpoint
`/api/v2/clients/{clientId}/credentials/{credentialId}` (Assumed based on context)
### Parameters
#### Path Parameters
- **clientId** (string) - Required - ID of the client.
- **credentialId** (string) - Required - ID of the credential.
### Request Example
```csharp
await client.Clients.Credentials.GetAsync("client_id", "credential_id");
```
### Response
#### Success Response (200)
- **credential** (object) - The details of the client credential.
#### Response Example
(Structure based on GetClientCredentialResponseContent return type)
```json
{
"id": "credential_id",
"credential_type": "public_key",
"name": "My Public Key Credential"
}
```
```
--------------------------------
### ImportAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Import wrapped key material and activate an encryption key. Requires the key ID and the wrapped key content.
```APIDOC
## ImportAsync
### Description
Import wrapped key material and activate encryption key.
### Method
POST (inferred)
### Endpoint
/keys/encryption/{kid}/import
### Parameters
#### Path Parameters
- **kid** (string) - Required - The ID of the encryption key to import.
#### Request Body
- **WrappedKey** (string) - Required - The wrapped key material to import.
### Request Example
```csharp
await client.Keys.Encryption.ImportAsync(
"kid",
new ImportEncryptionKeyRequestContent { WrappedKey = "wrapped_key" }
);
```
### Response
#### Success Response (200)
- **Id** (string) - The ID of the imported encryption key.
- **Status** (string) - The status of the imported key (e.g., 'active').
```
--------------------------------
### Get Client Credential
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the details of a specific client credential using the client ID and credential ID.
```csharp
await client.Clients.Credentials.GetAsync("client_id", "credential_id");
```
--------------------------------
### Get Auth0 Action Module Details
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve details of a specific Auth0 Actions Module by its unique identifier.
```csharp
await client.Actions.Modules.GetAsync("id");
```
--------------------------------
### Auth0 Authentication API Usage (v7 & v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
The Auth0.AuthenticationApi package is unchanged between v7 and v8. This example shows how to obtain a token using Resource Owner Password credentials.
```csharp
using Auth0.AuthenticationApi;
var client = new AuthenticationApiClient(new Uri("https://YOUR_DOMAIN"));
var tokenRequest = new ResourceOwnerTokenRequest
{
ClientId = "YOUR_CLIENT_ID",
ClientSecret = "YOUR_CLIENT_SECRET",
Username = "user@example.com",
Password = "password",
Scope = "openid profile"
};
var token = await client.GetTokenAsync(tokenRequest);
```
--------------------------------
### v8 User Creation Request and Response
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Illustrates the v8 approach to creating a user, using 'RequestContent' for requests and 'ResponseContent' for responses. The response type is now more specific.
```csharp
// Request type named *RequestContent, response is *ResponseContent
var request = new CreateUserRequestContent
{
Email = "user@example.com",
Connection = "Username-Password-Authentication",
Password = "SecurePassword123!"
};
CreateUserResponseContent createdUser = await client.Users.CreateAsync(request);
// createdUser is of type CreateUserResponseContent
```
--------------------------------
### Get a Rate Limit Policy by ID
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves a specific rate limit policy using its unique identifier.
```csharp
await client.RateLimitPolicies.GetAsync("id");
```
--------------------------------
### Create Directory Provisioning Configuration
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Creates a new directory provisioning configuration for a specified connection ID. Use this when setting up a new directory provisioning.
```csharp
await client.Connections.DirectoryProvisioning.CreateAsync(
"id",
new CreateDirectoryProvisioningRequestContent()
);
```
--------------------------------
### Retrieve Branding Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Use this snippet to get the current branding settings for your Auth0 tenant. No parameters are required.
```csharp
await client.Branding.GetAsync();
```
--------------------------------
### Get SNS Provider Async
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves configuration details for an AWS SNS push notification provider that has been enabled for MFA.
```APIDOC
## Get SNS Provider Async
### Description
Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review Configure Push Notifications for MFA.
### Method
GET
### Endpoint
/api/v2/guardian/factors/push-notification/sns (inferred)
### Response
#### Success Response (200)
- **response** (GetGuardianFactorsProviderSnsResponseContent) - The configuration details of the SNS provider.
#### Response Example
```json
{
"example": "GetGuardianFactorsProviderSnsResponseContent"
}
```
```
--------------------------------
### Get Branding Phone Provider
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the details of a specific phone provider. You can also specify fields to include or exclude.
```csharp
await client.Branding.Phone.Providers.GetAsync("id");
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a new API associated with your tenant.
```APIDOC
## CreateAsync Resource Server
### Description
Create a new API associated with your tenant. Note that all new APIs must be registered with Auth0. For more information, read APIs.
### Method
POST (assumed based on operation)
### Endpoint
/api/v2/resource-servers (assumed based on operation)
### Parameters
#### Request Body
- **request** (CreateResourceServerRequestContent) - Required - Content for creating the resource server.
- **identifier** (string) - Required - The identifier for the new resource server.
### Request Example
```csharp
await client.ResourceServers.CreateAsync(
new CreateResourceServerRequestContent { Identifier = "identifier" }
);
```
### Response
#### Success Response (201)
- **CreateResourceServerResponseContent** - Details of the created resource server.
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a Connection Profile.
```APIDOC
## CreateAsync Connection Profile
### Description
Create a Connection Profile.
### Method
POST
### Endpoint
/api/v2/connection-profiles
### Parameters
#### Request Body
- **name** (string) - Required - The name of the connection profile.
- **assign_membership_to** (string) - Optional - Specifies how to assign membership.
### Request Example
```csharp
await client.ConnectionProfiles.CreateAsync(new CreateConnectionProfileRequestContent { Name = "name" });
```
### Response
#### Success Response (201)
- **id** (string) - The ID of the created connection profile.
- **name** (string) - The name of the created connection profile.
- **assign_membership_to** (string) - The membership assignment setting.
### Response Example
```json
{
"id": "string",
"name": "string",
"assign_membership_to": "string"
}
```
```
--------------------------------
### Get Action Version
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve a specific version of an action. An action version is created whenever an action is deployed and is immutable.
```APIDOC
## Get Action Version
### Description
Retrieve a specific version of an action. An action version is created whenever an action is deployed. An action version is immutable, once created.
### Method
GET (Assumed based on action)
### Endpoint
/api/v2/actions/{actionId}/versions/{id} (Assumed based on action)
### Parameters
#### Path Parameters
- **actionId** (string) - Required - The ID of the action.
- **id** (string) - Required - The ID of the action version.
### Request Example
```csharp
await client.Actions.Versions.GetAsync("actionId", "id");
```
```
--------------------------------
### Retrieve Log Stream Configuration and Status
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Use this to get the details of a specific log stream. The 'id' parameter is required.
```csharp
await client.LogStreams.GetAsync("id");
```
--------------------------------
### Apply Code Formatting
Source: https://github.com/auth0/auth0.net/blob/master/CONTRIBUTING.md
Automatically format the code to comply with the project's established style guidelines.
```bash
dotnet format
```
--------------------------------
### Get All Network ACLs
Source: https://github.com/auth0/auth0.net/blob/master/Examples.md
Retrieves a paginated list of all configured Network ACLs. It iterates through the results and prints details for each ACL.
```csharp
using Auth0.ManagementApi;
public async Task GetAllNetworkAcls()
{
var pager = await client.NetworkAcls.ListAsync(new ListNetworkAclsRequestParameters());
await foreach (var acl in pager)
{
Console.WriteLine($"Network ACL ID: {acl.Id}");
Console.WriteLine($"Description: {acl.Description}");
Console.WriteLine($"Priority: {acl.Priority}");
Console.WriteLine($"Active: {acl.Active}");
Console.WriteLine($"Created At: {acl.CreatedAt}");
Console.WriteLine($"Updated At: {acl.UpdatedAt}");
}
}
```
--------------------------------
### ListAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieve a list of directory provisioning configurations of a tenant. This method allows fetching multiple configurations with optional filtering and pagination.
```APIDOC
## ListAsync
### Description
Retrieve a list of directory provisioning configurations of a tenant.
### Method
GET (inferred)
### Endpoint
/api/v2/connections/{id}/provisioning (inferred)
### Parameters
#### Query Parameters
- **from** (string) - Optional - Specifies the starting point for the list.
- **take** (integer) - Optional - Specifies the number of items to retrieve.
### Request Example
```csharp
await client.Connections.DirectoryProvisioning.ListAsync(
new ListDirectoryProvisioningsRequestParameters { From = "from", Take = 1 }
);
```
### Response
#### Success Response (200)
- **directory_provisionings** (array) - A list of directory provisioning configurations.
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a phone provider. The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
```APIDOC
## CreateAsync
### Description
Create a phone provider. The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
### Method
POST
### Endpoint
/api/v2/branding/phone-providers
### Parameters
#### Request Body
- **name** (string) - Required - The name of the phone provider.
- **credentials** (object) - Required - The credentials for the phone provider.
- **enabled** (boolean) - Optional - Whether the provider is enabled.
### Request Example
```json
{
"name": "twilio",
"credentials": {
"auth_token": "auth_token"
},
"enabled": true
}
```
### Response
#### Success Response (201)
- **name** (string) - The name of the phone provider.
- **credentials** (object) - The credentials for the phone provider.
- **enabled** (boolean) - Whether the provider is enabled.
### Response Example
```json
{
"name": "twilio",
"credentials": {},
"enabled": true
}
```
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Creates a new Flows Vault connection with specified details, including name, application ID, and setup configuration.
```APIDOC
## CreateAsync
### Description
Creates a new Flows Vault connection with specified details, including name, application ID, and setup configuration.
### Method
POST
### Endpoint
/api/v2/flows/vault/connections
### Parameters
#### Request Body
- **request** (CreateFlowsVaultConnectionRequestContent) - Required - The content for creating the Flows Vault connection.
- **Name** (string) - Required - The name of the connection.
- **AppId** (FlowsVaultConnectionAppIdEnum) - Required - The application ID for the connection.
- **Setup** (FlowsVaultConnectioSetup) - Required - The setup configuration for the connection.
- **Type** (FlowsVaultConnectioSetupTypeEnum) - Required - The type of setup (e.g., ApiKey).
- **ApiKey** (string) - Required if Type is ApiKey - The API key for authentication.
- **BaseUrl** (string) - Optional - The base URL for the service.
### Request Example
```json
{
"Name": "name",
"AppId": "activecampaign",
"Setup": {
"Type": "api_key",
"ApiKey": "api_key",
"BaseUrl": "base_url"
}
}
```
### Response
#### Success Response (200)
- **CreateFlowsVaultConnectionResponseContent** (object) - The response content after creating the connection.
```
--------------------------------
### Create Resource Server
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a new API associated with your tenant. All new APIs must be registered with Auth0. Refer to Auth0 API documentation for more details.
```csharp
await client.ResourceServers.CreateAsync(
new CreateResourceServerRequestContent { Identifier = "identifier" }
);
```
--------------------------------
### Create User: v7 vs v8
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Compares the C# code for creating a user in Auth0 .NET SDK v7 and v8. Note the change in request object naming.
```csharp
var userRequest = new UserCreateRequest
{
Email = "newuser@example.com",
Connection = "Username-Password-Authentication",
Password = "SecureP@ssw0rd!",
EmailVerified = true
};
var user = await client.Users.CreateAsync(userRequest);
Console.WriteLine($"Created user: {user.UserId}");
```
```csharp
var request = new CreateUserRequestContent
{
Email = "newuser@example.com",
Connection = "Username-Password-Authentication",
Password = "SecureP@ssw0rd!",
EmailVerified = true
};
var user = await client.Users.CreateAsync(request);
Console.WriteLine($"Created user: {user.UserId}");
```
--------------------------------
### client.AttackProtection.BotDetection.GetAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the current Bot Detection configuration settings for your tenant. This allows you to review your existing bot protection setup.
```APIDOC
## client.AttackProtection.BotDetection.GetAsync
### Description
Get the Bot Detection configuration of your tenant.
### Method
Not specified (SDK method)
### Endpoint
Not specified (SDK method)
### Parameters
None
### Request Example
```csharp
await client.AttackProtection.BotDetection.GetAsync();
```
### Response
#### Success Response
- **GetBotDetectionSettingsResponseContent** - The current Bot Detection settings.
#### Response Example
Not specified in source.
```
--------------------------------
### Configure Request Options (v8)
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
V8 allows per-request configuration using the RequestOptions class, enabling customization of timeouts, retry counts, and additional headers. This example shows how to set these options.
```csharp
var options = new RequestOptions
{
Timeout = TimeSpan.FromSeconds(30),
MaxRetries = 3,
AdditionalHeaders = new[] { new KeyValuePair("X-Custom-Header", "value") }
};
var user = await client.Users.GetAsync("user_id", new GetUserRequestParameters(), options);
```
--------------------------------
### Get User MFA Enrollments
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the first multi-factor authentication enrollment for a specific user. Requires the user's ID.
```csharp
await client.Users.Enrollments.GetAsync("id");
```
--------------------------------
### Create Connection: v7 vs v8
Source: https://github.com/auth0/auth0.net/blob/master/V8_MIGRATION_GUIDE.md
Compares the C# code for creating a connection in Auth0 .NET SDK v7 and v8. Note the change in request object naming and the enum type for strategy.
```csharp
var request = new ConnectionCreateRequest
{
Name = "my-database",
Strategy = "auth0"
};
Connection connection = await client.Connections.CreateAsync(request);
```
```csharp
var request = new CreateConnectionRequestContent
{
Name = "my-database",
Strategy = ConnectionIdentityProviderEnum.Auth0
};
CreateConnectionResponseContent connection = await client.Connections.CreateAsync(request);
```
--------------------------------
### Get Risk Assessments Settings
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Retrieves the current tenant settings for risk assessments. Use this to view the enabled status and configuration.
```csharp
await client.RiskAssessments.Settings.GetAsync();
```
--------------------------------
### CreateAsync
Source: https://github.com/auth0/auth0.net/blob/master/reference.md
Create a new Token Exchange Profile within your tenant.
```APIDOC
## CreateAsync TokenExchangeProfiles
### Description
Create a new Token Exchange Profile within your tenant.
### Method
POST
### Endpoint
/token-exchange-profiles
### Parameters
#### Request Body
- **request** (CreateTokenExchangeProfileRequestContent) - Required - The content for the new Token Exchange Profile.
- **Name** (string) - Required - The name of the Token Exchange Profile.
- **SubjectTokenType** (string) - Required - The type of the subject token.
- **ActionId** (string) - Required - The ID of the action to perform.
- **Type** (TokenExchangeProfileTypeEnum) - Required - The type of the Token Exchange Profile (e.g., CustomAuthentication).
### Request Example
```csharp
await client.TokenExchangeProfiles.CreateAsync(new CreateTokenExchangeProfileRequestContent
{
Name = "name",
SubjectTokenType = "subject_token_type",
ActionId = "action_id",
Type = TokenExchangeProfileTypeEnum.CustomAuthentication,
});
```
### Response
#### Success Response (200 or 201)
- **id** (string) - The ID of the created Token Exchange Profile.
- **name** (string) - The name of the Token Exchange Profile.
- **subject_token_type** (string) - The type of the subject token.
- **action_id** (string) - The ID of the action.
- **type** (TokenExchangeProfileTypeEnum) - The type of the Token Exchange Profile.
```