std :: http::oauth2
Struct std::OAuth2Token
struct OAuth2Token {
struct String accessToken;
struct String refreshToken;
struct String tokenType;
long long expiresIn;
}Fields
empty if the provider didn't return one
usually "Bearer"
seconds; 0 if not returned
Methods
§
static struct OAuth2Token exchange_code(
const &char tokenHost,
unsigned short tokenPort,
const &char tokenPath,
const &char clientId,
const &char clientSecret,
const &char code,
const &char redirectUri,
?&int ok,
)source · definitionExchanges an authorization code for tokens: POSTs 'grant_type=authorization_code&code=...&redirect_uri=...&client_id=... &client_secret=...' to '<tokenHost>:<tokenPort><tokenPath>'. *ok is set to 0 on any transport/HTTP-status/JSON-shape failure.
§
static struct OAuth2Token refresh(
const &char tokenHost,
unsigned short tokenPort,
const &char tokenPath,
const &char clientId,
const &char clientSecret,
const &char refreshToken,
?&int ok,
)source · definitionExchanges a refresh token for a fresh access token ('grant_type=refresh_token&refresh_token=...&client_id=...&client_secret=...').
Releases the three owned strings.
= drop()