LeadX.Identity.Client 1.0.5

LeadX.Identity.Client

The LeadX.Identity.Client library facilitates authentication with the LeadX Auth server. It provides functionality for both clients requesting access tokens and resource servers validating tokens.

For Clients: Requesting Access Tokens

To integrate the LeadX Auth Client into your application, follow these steps:

  1. Configure LeadX Auth Client in Startup.cs:

    Register the LeadX Auth Client with the necessary configuration options:

     public void ConfigureServices(IServiceCollection services)
     {
         services.AddLeadXIdentityClient(options =>
         {
             options.ClientId = "your-client-id"; // The client ID provided by LeadX
             options.ClientSecret = "your-client-secret"; // The client secret provided by LeadX
             options.Audience = "https://your-audience-url"; // The URL of the resource server or API
             options.Scopes = new string[] { "offline_access" }; // Scopes required for your application
             options.Issuer = "https://your-issuer-url"; // The URL of the LeadX Auth server
         });
     }
    
  2. Inject and Use ILeadXTokenService in Your Application:

    Inject the ILeadXTokenService interface into your classes via constructor injection to interact with the authentication services:

    using LeadX.Identity.Client.Services;
    using LeadX.Identity.Client.Models;
    using System.Threading.Tasks;
    
    public class ExampleController : ControllerBase
    {
        private readonly ILeadXTokenService _tokenService;
    
        public ExampleController(ILeadXTokenService tokenService)
        {
            _tokenService = tokenService;
        }
    
        [HttpGet("resource")]
        public async Task<IActionResult> GetResource()
        {
            try
            {
                // Retrieve the access token
                var accessToken = await _tokenService.GetAccessTokenAsync();
    
                // Use the access token to make an HTTP call to the resource
            }
            catch (LeadXApiException exception) when (exception.StatusCode == HttpStatusCode.Unauthorized)
            {
                // Handle expired or revoked access token by renewing it
                await _tokenService.RenewAccessTokenAsync();
    
                // Retrieve a new access token
                var freshAccessToken = await _tokenService.GetAccessTokenAsync();
    
                // Use the fresh access token to make an HTTP call to the resource
            }
        }
    }
    

For Resource Servers: Authenticating Requests

To configure your resource server for token validation, follow these steps:

  1. Configure LeadX Authentication in Startup.cs:

    Add and configure LeadX Authentication services in the ConfigureServices method:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddLeadXAuthentication(options =>
        {
            options.AcceptLegacyToken = true; // Enable support for legacy tokens if needed
            options.LegacySigningKey = configuration["AppSettings:AuthenticationDetail:AppSecretKey"]; // Key used for signing legacy tokens
            options.LeadXCoreConnectionString = configuration["AppSettings:ConnectionStrings:DefaultConnection"]; // Connection string for LeadX core
            options.Issuer = configuration["AppSettings:AuthenticationDetail:Authority"]; // Authority URL for token issuer
            options.Audience = configuration["AppSettings:AuthenticationDetail:Audience"]; // Audience URL for the resource server
            options.ValidateUsingIntrospectEndpoint = true; // Enable token introspection validation
            options.ValidateTokenSignatureLocally = true; // Validate token signatures locally
        });
    }
    
  2. Configure Middleware in Startup.cs: Ensure that your application is set up to use authentication and authorization middleware:

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggingBuilder)
    {
        // -- other middleware configurations --
    
        app.UseAuthentication(); // Adds authentication middleware to the pipeline
        app.UseAuthorization();  // Adds authorization middleware to the pipeline
    
        // -- other middleware configurations --
    }
    
    

BREAKING CHANGES

This package upgrades Microsoft.Data.SqlClient to a minimum version of "5.2.1" and Dapper to a minimum version of "2.1.35", which in turn upgrades the System.IdentityModel.Tokens.Jwt. This breaks the legacy signing key used by LeadX to sign the tokens, as the System.IdentityModel.Tokens.Jwt requires a longer keysize. To ensure continued working, replace security key creation with the following:

var securityKey =
  SecurityKeyExtensions.EnsureMinimumKeyLength(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_options.Value.AuthenticationDetail.AppSecretKey)), 64);

Showing the top 20 packages that depend on LeadX.Identity.Client.

Packages Downloads
Birdigo.Sdk
Typed .NET client for the Birdigo API with M2M authentication, tenant-scoped clients (organizations, leads, labels, conversations, calls) and automatic vendorId resolution.
0
Birdigo.Sdk
Typed .NET client for the Birdigo API with M2M authentication, tenant-scoped clients (organizations, leads, labels, conversations, calls, form fields) and automatic vendorId resolution.
0

Version Downloads Last updated
1.0.8 0 07/13/2026
1.0.7 0 07/13/2026
1.0.6 0 07/13/2026
1.0.5 0 07/13/2026
1.0.4 0 07/13/2026
1.0.3 0 07/13/2026
1.0.2 0 07/13/2026
1.0.1 0 07/13/2026
1.0.0 0 07/13/2026