atproto/browser/oauth/tokens
Async mirror of atproto/oauth/tokens.gleam: token endpoint calls —
exchange an authorization code for DPoP-bound tokens, refresh them, and
best-effort revocation. A thin async wrapper over the shared effect kernel
in atproto_core/oauth/tokens; the Tokens type is
re-exported from there.
Types
pub type Tokens =
tokens.Tokens
Values
pub fn exchange_code(
client: xrpc.Client,
flow flow: flow.Flow,
code code: String,
redirect_uri redirect_uri: String,
extra_form extra_form: List(#(String, String)),
) -> promise.Promise(Result(tokens.Tokens, String))
pub fn refresh(
client: xrpc.Client,
token_endpoint token_endpoint: String,
refresh_token refresh_token: String,
client_id client_id: String,
dpop_key dpop_key: dpop.DpopKey,
extra_form extra_form: List(#(String, String)),
) -> promise.Promise(Result(tokens.Tokens, String))
pub fn revoke(
client: xrpc.Client,
issuer issuer: String,
refresh_token refresh_token: String,
client_id client_id: String,
dpop_key dpop_key: dpop.DpopKey,
extra_form extra_form: List(#(String, String)),
) -> promise.Promise(Nil)
Best-effort refresh-token revocation at logout: discover the AS revocation endpoint from the issuer and revoke. Failures are ignored (the caller clears its local session regardless).