





















Check out the new server-side C# SDK right here!
With this launch, C# developers can more easily interface with the Clerk Backend API to manage users, organizations, and sessions.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.EmailAddresses.GetAsync(emailAddressId: "email_address_id_example");
// handle responseThis release also makes it straightforward to authenticate backend requests in ASP.NET, Blazor, and other C# web frameworks:
using Clerk.BackendAPI.Helpers.Jwks;
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class UserAuthentication
{
public static async Task<bool> IsSignedInAsync(HttpRequestMessage request)
{
var options = new AuthenticateRequestOptions(
secretKey: Environment.GetEnvironmentVariable("CLERK_SECRET_KEY"),
authorizedParties: new string[] { "https://example.com" }
);
var requestState = await AuthenticateRequest.AuthenticateRequestAsync(request, options);
return requestState.isSignedIn();
}
}此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。