Skip to content

A modern, idiomatic .NET SDK for Authorizer.dev - supporting authentication and user management in ASP.NET Core backends, Blazor apps, and other .NET projects.

License

Notifications You must be signed in to change notification settings

cheesam/Authorizer.DotNet

Repository files navigation

Authorizer.DotNet

NuGet Version License .NET

Official .NET SDK for Authorizer.dev - A comprehensive authentication and authorization service for .NET applications.

🚀 Quick Start

dotnet add package Authorizer.DotNet
// Configure in Program.cs
builder.Services.AddAuthorizer(builder.Configuration, "Authorizer");

// Use in your code
public class AuthController : ControllerBase
{
    private readonly IAuthorizerClient _client;

    public AuthController(IAuthorizerClient client) => _client = client;

    [HttpPost("login")]
    public async Task<IActionResult> Login([FromBody] LoginRequest request)
    {
        var response = await _client.LoginAsync(request);
        return response.IsSuccess ? Ok(response.Data) : BadRequest(response.Errors);
    }
}
// appsettings.json
{
  "Authorizer": {
    "AuthorizerUrl": "https://your-authorizer-instance.com",
    "ClientId": "your-client-id",
    "RedirectUrl": "https://your-app.com/auth/callback"
  }
}

✨ Features

  • 🔐 Complete authentication (login, signup, OAuth, JWT)
  • 🛡️ Multi-factor authentication (OTP, TOTP)
  • ✉️ Passwordless magic link authentication
  • 👤 User & session management
  • 🎯 Multi-framework support (ASP.NET Core, Blazor, Console)
  • 🔄 .NET 6.0, 7.0, and 8.0 compatible
  • ⚡ Production-ready with comprehensive testing

📖 Documentation

Complete Documentation →

All documentation has been consolidated into one comprehensive guide covering:

  • Installation & Configuration
  • All Authentication Methods
  • Complete API Reference
  • Sample Applications
  • Advanced Topics (Cross-Domain, OAuth, MFA, etc.)
  • Testing & Troubleshooting
  • Migration Guides

📦 Sample Applications

Explore working examples in the samples/ directory:

Run any sample:

cd samples/Authorizer.Sample.BlazorServer
dotnet run

🔧 Core Methods

// Authentication
await client.LoginAsync(request);
await client.SignupAsync(request);
await client.MagicLinkLoginAsync(request);
await client.AuthorizeAsync(request);  // OAuth
await client.LogoutAsync(token);

// User Management
await client.GetProfileAsync(token);
await client.UpdateProfileAsync(request, token);
await client.GetSessionAsync();

// Password Management
await client.ForgotPasswordAsync(request);
await client.ResetPasswordAsync(request);
await client.ChangePasswordAsync(request);

// MFA
await client.VerifyOtpAsync(request);
await client.ResendOtpAsync(request);

// Utilities
await client.GetMetaAsync();           // Feature detection
await client.ValidateJwtAsync(token);

🆘 Common Issues

"HTTP 401 Unauthorized"

  • Verify ClientId is correct in configuration

"HTTP 422 Cross-Domain Errors"

"Connection Timeout"

  • Increase HttpTimeout in configuration
  • Check network connectivity

📊 Testing

# Run all tests (137 total: 115 unit + 22 integration)
dotnet test

# Run unit tests only
dotnet test tests/Authorizer.DotNet.UnitTests/

# Run integration tests (requires Authorizer instance)
dotnet test tests/Authorizer.DotNet.IntegrationTests/

🤝 Contributing

Contributions are welcome! Please see DOCUMENTATION.md for guidelines.

📝 Changelog

See CHANGELOG.md for version history and breaking changes.

💬 Support

📄 License

MIT License - see LICENSE file for details.


Made with ❤️ in London

About

A modern, idiomatic .NET SDK for Authorizer.dev - supporting authentication and user management in ASP.NET Core backends, Blazor apps, and other .NET projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages