olp-cpp-sdk  1.19.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)
 Creates the TokenResult instance. More...
 
 TokenResult (std::string access_token, std::chrono::seconds expires_in)
 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...
 

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 
)

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.

◆ TokenResult() [2/2]

olp::authentication::TokenResult::TokenResult ( std::string  access_token,
std::chrono::seconds  expires_in 
)

Creates the TokenResult instance.

Parameters
access_tokenThe access token issued by the authorization server.
expires_inThe expiry time of 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.

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