10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::oauth::OAuthTokenResponse Class Reference

#include <OAuthTokenResponse.h>

Detailed Description

Encapsulates results from tenduke::oauth::OAuthTokenRequest.

Public Member Functions

 OAuthTokenResponse (std::string accessToken, std::string refreshToken, const std::int64_t expiresAt, std::shared_ptr< tenduke::json::JSONObject > additionalProperties)
 Constructs new instance.
std::int64_t getExpiresAtOrDoesNotExpire () const
 Returns the expiration time for the access token state.

Public Attributes

const std::string accessToken
 OAuth access token.
const std::string refreshToken
 Refresh token.
const std::int64_t expiresAt
 Time (epoch seconds) when the access token expires.
std::shared_ptr< tenduke::json::JSONObject > additionalProperties
 Additional response properties.

Static Public Attributes

static const std::int64_t NO_EXPIRES_IN = -1
 Magic value to indicate that the response did not contain expires_in.

Constructor & Destructor Documentation

◆ OAuthTokenResponse()

tenduke::oauth::OAuthTokenResponse::OAuthTokenResponse ( std::string accessToken,
std::string refreshToken,
const std::int64_t expiresAt,
std::shared_ptr< tenduke::json::JSONObject > additionalProperties )
inline

Constructs new instance.

Parameters
accessToken-
refreshToken-
expiresAt-
additionalProperties-

Member Function Documentation

◆ getExpiresAtOrDoesNotExpire()

std::int64_t tenduke::oauth::OAuthTokenResponse::getExpiresAtOrDoesNotExpire ( ) const
inline

Returns the expiration time for the access token state.

expires_in is only RECOMMENDED (RFC 6749, section 5.1), and if it is missing, the lifetime of the token is not known. In this case the token is considered not to expire, and the application relies on the server rejecting the expired token.

Returns
expiresAt, or tenduke::oauth::TOKEN_DOES_NOT_EXPIRE if the response did not contain expires_in

Member Data Documentation

◆ expiresAt

const std::int64_t tenduke::oauth::OAuthTokenResponse::expiresAt

Time (epoch seconds) when the access token expires.

Expires will be NO_EXPIRES_IN if the response did not contain "expires_in"-property.

NOTE: We store expires_at, not expires_in. The value of expires_in is lifetime, which is quite difficult to use as time keeps going on. We typically take current time in epoch seconds and add the expires_in to give us expires_at.

◆ refreshToken

const std::string tenduke::oauth::OAuthTokenResponse::refreshToken

Refresh token.

Will be .empty() if the response did not contain "refresh_token"-property.


The documentation for this class was generated from the following file: