olp-cpp-sdk  1.22.0
Public Member Functions | List of all members
olp::authentication::TokenResult Class Reference

A parsed response received from the OAuth2.0 token endpoint. More...

#include <TokenResult.h>

Public Member Functions

 TokenResult (std::string access_token, time_t expiry_time, boost::optional< std::string > scope)
 Creates the TokenResult instance. More...
 
 TokenResult (std::string access_token, std::chrono::seconds expires_in, boost::optional< std::string > scope)
 Creates the TokenResult instance. More...
 
 TokenResult ()=default
 Creates the default TokenResult instance.
 
const std::string & GetAccessToken () const
 Gets the access token issued by the authorization server. More...
 
time_t GetExpiryTime () const
 Gets the Epoch time when the token expires, or -1 if the token is invalid. More...
 
std::chrono::seconds GetExpiresIn () const
 Gets the access token expiry time. More...
 
const boost::optional< std::string > & GetScope () const
 Gets the scope that is assigned to the access token. More...
 

Detailed Description

A parsed response received from the OAuth2.0 token endpoint.

You can get the following information: the access token issued by the authorization server (GetAccessToken), and its expiry time (GetExpiryTime).

Constructor & Destructor Documentation

◆ TokenResult() [1/2]

olp::authentication::TokenResult::TokenResult ( std::string  access_token,
time_t  expiry_time,
boost::optional< std::string >  scope 
)

Creates the TokenResult instance.

Parameters
access_tokenThe access token issued by the authorization server.
expiry_timeThe Epoch time when the token expires, or -1 if the token is invalid.
scopeThe scope assigned to the access token.

◆ TokenResult() [2/2]

olp::authentication::TokenResult::TokenResult ( std::string  access_token,
std::chrono::seconds  expires_in,
boost::optional< std::string >  scope 
)

Creates the TokenResult instance.

Parameters
access_tokenThe access token issued by the authorization server.
expires_inThe expiry time of the access token.
scopeThe scope assigned to the access token.

Member Function Documentation

◆ GetAccessToken()

const std::string& olp::authentication::TokenResult::GetAccessToken ( ) const

Gets the access token issued by the authorization server.

Returns
The access token issued by the authorization server.

◆ GetExpiresIn()

std::chrono::seconds olp::authentication::TokenResult::GetExpiresIn ( ) const

Gets the access token expiry time.

Returns
The expiry time of the access token.

◆ GetExpiryTime()

time_t olp::authentication::TokenResult::GetExpiryTime ( ) const

Gets the Epoch time when the token expires, or -1 if the token is invalid.

Returns
The Epoch time when the token expires, or -1 if the token is invalid.

◆ GetScope()

const boost::optional<std::string>& olp::authentication::TokenResult::GetScope ( ) const

Gets the scope that is assigned to the access token.

Returns
The optional string that contains the scope assigned to the access token.

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