AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Functions | Variables
LWAAuthorizationAdapter.cpp File Reference
#include <algorithm>
#include <functional>
#include <sstream>
#include <unordered_map>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <rapidjson/stringbuffer.h>
#include <AVSCommon/Utils/DeviceInfo.h>
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
#include <AVSCommon/Utils/LibcurlUtils/CallbackData.h>
#include <AVSCommon/Utils/LibcurlUtils/HttpPost.h>
#include <acsdkAuthorization/LWA/LWAAuthorizationAdapter.h>
#include <acsdkAuthorization/private/Logging.h>
Include dependency graph for LWAAuthorizationAdapter.cpp:

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::acsdkAuthorization
 
 alexaClientSDK::acsdkAuthorization::lwa
 

Functions

static const std::string alexaClientSDK::acsdkAuthorization::lwa::TAG ("LWAAuthorizationAdapter")
 String to identify log entries originating from this file. More...
 
static AuthObserverInterface::Error alexaClientSDK::acsdkAuthorization::lwa::getErrorCode (const std::string &error)
 
static std::chrono::steady_clock::time_point alexaClientSDK::acsdkAuthorization::lwa::calculateTimeToRetry (int retryCount)
 
static AuthObserverInterface::Error alexaClientSDK::acsdkAuthorization::lwa::mapHTTPCodeToError (long code)
 
static AuthObserverInterface::Error alexaClientSDK::acsdkAuthorization::lwa::parseLWAResponse (const avsCommon::utils::libcurlUtils::HTTPResponse &response, rapidjson::Document *document)
 
static size_t alexaClientSDK::acsdkAuthorization::lwa::writeCallback (char *dataBuffer, size_t blockSize, size_t numBlocks, void *dataStream)
 Write callback function used for CURLOPT_WRITEFUNCTION option in libcurl. More...
 
static HTTPResponse alexaClientSDK::acsdkAuthorization::lwa::doGet (const std::string &url)
 

Variables

static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_USER_CODE [] = "user_code"
 Key for user_code values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_DEVICE_CODE [] = "device_code"
 Key for device_code values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_VERIFICATION_URI [] = "verification_uri"
 Key for verification_uri values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_EXPIRES_IN [] = "expires_in"
 Key for expires_in values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_INTERVAL [] = "interval"
 Key for interval values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_TOKEN_TYPE [] = "token_type"
 Key for interval values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_ACCESS_TOKEN [] = "access_token"
 Key for access_token values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_REFRESH_TOKEN [] = "refresh_token"
 Key for refresh_token values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_ERROR [] = "error"
 Key for error values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_NAME [] = "name"
 Key for name values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_USER_ID [] = "user_id"
 Key for user_id values in JSON returned by LWA. More...
 
static const char alexaClientSDK::acsdkAuthorization::lwa::JSON_KEY_EMAIL [] = "email"
 Key for email values in JSON returned by LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::JSON_VALUE_BEARER = "bearer"
 Expected token_type value returned from token requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_RESPONSE_TYPE = "response_type"
 response_type key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_CLIENT_ID = "client_id"
 client_id key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_SCOPE = "scope"
 scope key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_SCOPE_DATA = "scope_data"
 scope_data key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_GRANT_TYPE = "grant_type"
 grant_type key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_DEVICE_CODE = "device_code"
 device_code key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_USER_CODE = "user_code"
 user_code key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_KEY_REFRESH_TOKEN = "refresh_token"
 refresh_token key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_VALUE_REFRESH_TOKEN = "refresh_token"
 refresh_token value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::POST_VALUE_DEVICE_CODE = "device_code"
 device_code value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::SCOPE_ALEXA_ALL = "alexa:all"
 alexa:all value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::SCOPE_PROFILE = "profile"
 profile scope that requests customer information. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::SCOPE_PROFILE_USER_ID = "profile:user_id"
 profile:user_id scope that allows tying an access token to a specific account. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::HEADER_LINE_URLENCODED = "Content-Type: application/x-www-form-urlencoded"
 HTTP Header line specifying URL encoded data. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::HEADER_LINE_LANGUAGE_PREFIX = "Accept-Language: "
 Prefix of HTTP header line specifying language. More...
 
static const std::chrono::seconds alexaClientSDK::acsdkAuthorization::lwa::MIN_TOKEN_REQUEST_INTERVAL = std::chrono::seconds(5)
 Min time to wait between attempt to poll for a token while authentication is pending. More...
 
static const std::chrono::seconds alexaClientSDK::acsdkAuthorization::lwa::MAX_TOKEN_REQUEST_INTERVAL = std::chrono::seconds(60)
 Max time to wait between attempt to poll for a token while authentication is pending. More...
 
static const int alexaClientSDK::acsdkAuthorization::lwa::TOKEN_REQUEST_SLOW_DOWN_FACTOR = 2
 Scale factor to apply to interval between token poll requests when a 'slow_down' response is received. More...
 
static const std::unordered_map< std::string, AuthObserverInterface::Error > alexaClientSDK::acsdkAuthorization::lwa::g_nameToErrorMap
 Map error names from LWA to AuthObserverInterface::Error values. More...
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::DEFAULT_ADAPTER_ID = "lwa-adapter"
 Unique identifier for this adapter. More...
 

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0