Developers · SDKs
.NET SDK
The AuthGuard.Sdk package uses Microsoft.IdentityModel.JsonWebTokens. It is not on NuGet yet: build it from the repository's sdks/dotnet folder and publish it to an internal feed.
Reference
dotnet add package AuthGuard.Sdk --version 0.1.0Create a request and wait
using AuthGuard.Sdk;
using var intents = new IntentsClient(new IntentsClientOptions
{
BaseUrl = "https://identity.example.com",
ClientId = "1c9a2b3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
ClientSecret = Environment.GetEnvironmentVariable("AUTHGUARD_CLIENT_SECRET")!,
Scopes = new[] { IntentScopes.Write, IntentScopes.Read },
});
var created = await intents.CreateIntentAsync(
new CreateIntentRequest
{
OperationType = "invoice.pay",
SubjectEmail = "ana@example.com",
ExternalReference = "INV-42",
Fields = { ["amount"] = new MoneyValue("1250.00", "EUR") },
},
idempotencyKey: "erp-INV-42-attempt-1");
Console.WriteLine(created.Intent.ComparisonCode); // show it next to the operation
var decided = await intents.WaitForDecisionAsync(created.Intent.IntentId);
if (decided.State == IntentStates.Approved) { /* run the operation */ }Webhooks in ASP.NET
Read the body into a MemoryStream, pass the bytes and headers to the SDK's verifier and answer 400 if verification fails. Deduplicate on webhook-id.
Receipts and OIDC
The SDK checks the request digest and the receipt binding, and runs the OIDC flow with PKCE.
Error codes in this article
Was this page helpful?
Thank you. Your answer stays in this browser; nothing is sent.
Sorry about that. Try:
- searching for the exact text of the message or the error code
- the error code index
- asking your organization's administrator