AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Macros | Functions | Variables
CBLAuthDelegate.cpp File Reference
#include <algorithm>
#include <functional>
#include <iostream>
#include <random>
#include <sstream>
#include <unordered_map>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <AVSCommon/AVS/Initialization/AlexaClientSDKInit.h>
#include <AVSCommon/Utils/DeviceInfo.h>
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
#include <AVSCommon/Utils/LibcurlUtils/HttpPost.h>
#include <AVSCommon/Utils/Logger/Logger.h>
#include "CBLAuthDelegate/CBLAuthDelegate.h"
Include dependency graph for CBLAuthDelegate.cpp:

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::authorization
 
 alexaClientSDK::authorization::cblAuthDelegate
 

Macros

#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Functions

static const std::string alexaClientSDK::authorization::cblAuthDelegate::TAG ("CBLAuthDelegate")
 String to identify log entries originating from this file. More...
 
static AuthObserverInterface::Error alexaClientSDK::authorization::cblAuthDelegate::getErrorCode (const std::string &error)
 
static std::chrono::steady_clock::time_point alexaClientSDK::authorization::cblAuthDelegate::calculateTimeToRetry (int retryCount)
 
static AuthObserverInterface::Error alexaClientSDK::authorization::cblAuthDelegate::mapHTTPCodeToError (long code)
 
AuthObserverInterface::Error alexaClientSDK::authorization::cblAuthDelegate::parseLWAResponse (const avsCommon::utils::libcurlUtils::HTTPResponse &response, rapidjson::Document *document)
 

Variables

static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_USER_CODE [] = "user_code"
 Key for user_code values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_DEVICE_CODE [] = "device_code"
 Key for device_code values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_VERIFICATION_URI [] = "verification_uri"
 Key for verification_uri values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_EXPIRES_IN [] = "expires_in"
 Key for expires_in values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_INTERVAL [] = "interval"
 Key for interval values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_TOKEN_TYPE [] = "token_type"
 Key for interval values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_ACCESS_TOKEN [] = "access_token"
 Key for access_token values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_REFRESH_TOKEN [] = "refresh_token"
 Key for refresh_token values in JSON returned by LWA. More...
 
static const char alexaClientSDK::authorization::cblAuthDelegate::JSON_KEY_ERROR [] = "error"
 Key for error values in JSON returned by LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::CONFIG_ROOT_KEY = "cblAuthDelegate"
 Key for the the root config. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::JSON_VALUE_BEARER = "bearer"
 Expected token_type value returned from token requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_RESPONSE_TYPE = "response_type"
 response_type key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_CLIENT_ID = "client_id"
 client_id key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_SCOPE = "scope"
 scope key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_SCOPE_DATA = "scope_data"
 scope_data key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_GRANT_TYPE = "grant_type"
 grant_type key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_DEVICE_CODE = "device_code"
 device_code key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_USER_CODE = "user_code"
 user_code key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_KEY_REFRESH_TOKEN = "refresh_token"
 refresh_token key in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_VALUE_REFRESH_TOKEN = "refresh_token"
 refresh_token value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_VALUE_DEVICE_CODE = "device_code"
 device_code value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::POST_VALUE_ALEXA_ALL = "alexa:all"
 alexa:all value in POST requests to LWA. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::HEADER_LINE_URLENCODED = "Content-Type: application/x-www-form-urlencoded"
 HTTP Header line specifying URL encoded data. More...
 
static const std::string alexaClientSDK::authorization::cblAuthDelegate::HEADER_LINE_LANGUAGE_PREFIX = "Accept-Language: "
 Prefix of HTTP header line specifying language. More...
 
static const std::chrono::seconds alexaClientSDK::authorization::cblAuthDelegate::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::authorization::cblAuthDelegate::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::authorization::cblAuthDelegate::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::authorization::cblAuthDelegate::g_nameToErrorMap
 Map error names from LWA to AuthObserverInterface::Error values. More...
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

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