CoreStone.SDK.Dotnet.Auth
1.5.0
dotnet add package CoreStone.SDK.Dotnet.Auth --version 1.5.0
NuGet\Install-Package CoreStone.SDK.Dotnet.Auth -Version 1.5.0
<PackageReference Include="CoreStone.SDK.Dotnet.Auth" Version="1.5.0" />
<PackageVersion Include="CoreStone.SDK.Dotnet.Auth" Version="1.5.0" />
<PackageReference Include="CoreStone.SDK.Dotnet.Auth" />
paket add CoreStone.SDK.Dotnet.Auth --version 1.5.0
#r "nuget: CoreStone.SDK.Dotnet.Auth, 1.5.0"
#:package CoreStone.SDK.Dotnet.Auth@1.5.0
#addin nuget:?package=CoreStone.SDK.Dotnet.Auth&version=1.5.0
#tool nuget:?package=CoreStone.SDK.Dotnet.Auth&version=1.5.0
CoreStone.SDK.Dotnet.Auth
Authentication client for the CoreStone platform — register, login, MFA, token refresh, and logout.
Installation
dotnet add package CoreStone.SDK.Dotnet.Configuration
dotnet add package CoreStone.SDK.Dotnet.Auth
Setup
builder.Services
.AddCoreStoneConfiguration(o => {
o.BaseUrl = "https://api.yourapp.com";
o.ProjectKey = "prj-xxxxxxxxxxxxxxxx";
})
.AddCoreStoneAuth();
Usage
Register
public class RegisterController(IAuthClient auth) : Controller
{
public async Task<IActionResult> Register(RegisterRequest request)
{
var result = await auth.RegisterAsync(new RegisterRequest
{
IdentityType = "email",
Identifier = "user@example.com",
Password = "SecurePass123!",
DisplayName = "John Doe"
});
// Tokens are automatically stored — subsequent calls are authenticated
return Ok(result.User);
}
}
Login
var result = await auth.LoginAsync(new LoginRequest
{
IdentityType = "email",
Identifier = "user@example.com",
Password = "SecurePass123!"
});
if (result.MfaRequired)
{
// User has 2FA enabled — complete with VerifyTwoFactorAsync
var verified = await auth.VerifyTwoFactorAsync(new VerifyTwoFactorRequest
{
MfaToken = result.MfaToken!,
Code = "123456" // From authenticator app
});
}
Get Current User
var me = await auth.MeAsync();
Console.WriteLine($"Hello {me.Profile?.DisplayName}");
Logout
await auth.LogoutAsync();
// Tokens are automatically cleared
Automatic Token Refresh
The SDK silently refreshes the access token on 401 responses. You don't need to handle this manually — just catch CoreStoneException with Code == "SESSION_EXPIRED" to redirect to login when the refresh token also expires.
try
{
var data = await supportClient.ListTicketsAsync();
}
catch (CoreStoneException ex) when (ex.Code == "SESSION_EXPIRED")
{
// Redirect user to login
}
Supported Identity Types
| Value | Description |
|---|---|
email |
Email address |
phone |
Phone number |
username |
Username |
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CoreStone.SDK.Dotnet.Configuration (>= 1.5.0)
-
net9.0
- CoreStone.SDK.Dotnet.Configuration (>= 1.5.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on CoreStone.SDK.Dotnet.Auth:
| Package | Downloads |
|---|---|
|
CoreStone.SDK.Dotnet.Announcement
CoreStone SDK — announcements (fetch active announcements for the app). |
|
|
CoreStone.SDK.Dotnet.MenuManagement
CoreStone SDK — app menu management (fetch dynamic menus). |
|
|
CoreStone.SDK.Dotnet.UserManagement
CoreStone SDK — user profile management (get, update, delete account). |
|
|
CoreStone.SDK.Dotnet.Support
CoreStone SDK — support ticket management (create, list, reply, close). |
|
|
CoreStone.SDK.Dotnet.Notifications
CoreStone SDK — in-app notification inbox (list, unread count, mark read/unread, mark all read). |
GitHub repositories
This package is not used by any popular GitHub repositories.