oauth2
Generated by tinox doc
OAuth2 client for the Authorization Code grant with PKCE (RFC 6749 + RFC 7636) — the recommended flow for both server-side and public clients. Builds the provider authorize URL (with CSRF state and a PKCE code_verifier/code_challenge), exchanges an authorization code for tokens, and refreshes them.
| Module | Version | Group |
|---|---|---|
base64 | 1.0.0 | tinox.core |
crypto | 1.0.0 | tinox.core |
hex | 1.0.0 | tinox.core |
http | 1.0.0 | tinox.core |
json | 1.0.0 | tinox.core |
uri | 1.0.0 | tinox.core |
class OAuth2AuthorizeRequest
Fields
url | String | |
state | String | |
codeVerifier | String |
class OAuth2Client
Fields
authorizeUrl | String | |
tokenUrl | String | |
clientId | String | |
clientSecret | String | |
redirectUri | String |
Methods
fn new(authorizeUrl: String, tokenUrl: String, clientId: String, clientSecret: String, redirectUri: String) → OAuth2Client
fn buildAuthorizeUrl(scope: String) → OAuth2AuthorizeRequest
fn exchangeCode(code: String, codeVerifier: String) → OAuth2TokenResponse
fn refresh(refreshToken: String) → OAuth2TokenResponse
fn postToken(url: String, body: String) → OAuth2TokenResponse
class OAuth2TokenResponse
Fields
accessToken | String | |
refreshToken | String | |
tokenType | String | |
expiresIn | Int64 | |
idToken | String | |
ok | Bool | |
errorMessage | String |