olp-cpp-sdk
1.21.0
|
A set of settings that manages the TokenProviderCallback
and TokenProviderCancelCallback
functions.
More...
#include <OlpClientSettings.h>
Public Types | |
using | ApiKeyProviderType = std::function< std::string()> |
An alias for the ApiKey provider. | |
using | TokenProviderCancellableCallback = std::function< OauthTokenResponse(CancellationContext &)> |
Implemented by the client that should return the OAuth2 bearer access token if the operation is successful; an ApiError otherwise. More... | |
Public Attributes | |
TokenProviderCancellableCallback | token_provider = nullptr |
The user-provided function that returns the OAuth2 bearer access token if the operation is successful; an ApiError otherwise. More... | |
ApiKeyProviderType | api_key_provider = nullptr |
The user-provided function that returns ApiKey . More... | |
A set of settings that manages the TokenProviderCallback
and TokenProviderCancelCallback
functions.
The TokenProviderCallback
function requests the OAuth2 bearer access token. The TokenProviderCancelCallback
function cancels that request. Both functions are user-provided. The struct is used internally by the OlpClient
class.
using olp::client::AuthenticationSettings::TokenProviderCancellableCallback = std::function<OauthTokenResponse(CancellationContext&)> |
Implemented by the client that should return the OAuth2 bearer access token if the operation is successful; an ApiError
otherwise.
The access token should be used as the authorization header for the service calls. This allows for an external OAuth2 library to be used to provide the authentication functionality for any service.
The provided token should be authorized to access the resources provided by the HERE platform Services you are trying to request. Also, the token should not be expired by the time the service request is sent to the server. Otherwise, a service-specific authorization error is returned when calls are made.
CancellationContext
argument should be used to give the caller an ability to cancel the operation.
ApiKeyProviderType olp::client::AuthenticationSettings::api_key_provider = nullptr |
The user-provided function that returns ApiKey
.
If this provider is set, it is used instead of the token provider. The returned value, if not empty, is added as a URL parameter to each request.
TaskScheduler
as this might result in a deadlock. TokenProviderCancellableCallback olp::client::AuthenticationSettings::token_provider = nullptr |
The user-provided function that returns the OAuth2 bearer access token if the operation is successful; an ApiError
otherwise.
TokenProviderCancellableCallback
for more details.