olp-cpp-sdk  1.18.1
Public Types | Public Attributes | List of all members
olp::client::AuthenticationSettings Struct Reference

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...
 

Detailed Description

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.

Member Typedef Documentation

◆ TokenProviderCancellableCallback

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.

Member Data Documentation

◆ api_key_provider

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.

Note
This method must be synchronized and should not trigger any tasks on TaskScheduler as this might result in a deadlock.

◆ token_provider

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.

See also
TokenProviderCancellableCallback for more details.

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