.NET ATProtocol Library - Built for Source Gen
1.2 kB · 32 lines
Markdown
at main

CarpaNet.OAuth #

NuGet Version License

CarpaNet Logo

CarpaNet.OAuth is an OAuth library for CarpaNet.

1444070256569233

This library is experimental and not stable. Expect issues and bugs!

OAuthSession #

This is an OAuth 2.0 flow orchestrator supporting PAR (Pushed Authorization Requests), PKCE, and DPoP. Use this to produce an ATProtoOAuthClient via CallbackAsync or RestoreSessionAsync.

var config = new OAuthClientConfig
{
    ClientId = clientId,
    RedirectUri = redirectUri,
    Scope = "atproto transition:generic",
    JsonOptions = myJsonOptions,
    SessionStore = mySessionStore
};

using var oauthClient = new OAuthSession(config);
var authUrl = await oauthClient.AuthorizeAsync(handle);
// ... redirect user to authUrl, receive callback ...
var session = await oauthClient.CallbackAsync(callbackUrl);
// session implements IATProtoClient