AlexaClientSDK  1.23.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AuthObserverInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
19 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_AUTHOBSERVERINTERFACE_H_
20 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_AUTHOBSERVERINTERFACE_H_
21 
22 #include <ostream>
23 
24 namespace alexaClientSDK {
25 namespace avsCommon {
26 namespace sdkInterfaces {
27 
32 public:
34  enum class State {
38  REFRESHED,
40  EXPIRED,
43  };
44 
46  enum class Error {
48  SUCCESS,
50  UNKNOWN_ERROR,
52  AUTHORIZATION_FAILED,
54  UNAUTHORIZED_CLIENT,
56  SERVER_ERROR,
58  INVALID_REQUEST,
60  INVALID_VALUE,
62  AUTHORIZATION_EXPIRED,
64  UNSUPPORTED_GRANT_TYPE,
66  INVALID_CODE_PAIR,
68  AUTHORIZATION_PENDING,
70  SLOW_DOWN,
72  INTERNAL_ERROR,
74  INVALID_CBL_CLIENT_ID
75  };
76 
80  virtual ~AuthObserverInterface() = default;
81 
91  virtual void onAuthStateChange(State newState, Error error) = 0;
92 };
93 
101 inline std::ostream& operator<<(std::ostream& stream, const AuthObserverInterface::State& state) {
102  switch (state) {
104  return stream << "UNINITIALIZED";
106  return stream << "REFRESHED";
108  return stream << "EXPIRED";
110  return stream << "UNRECOVERABLE_ERROR";
111  }
112  return stream << "Unknown AuthObserverInterface::State!: " << state;
113 }
114 
122 inline std::ostream& operator<<(std::ostream& stream, const AuthObserverInterface::Error& error) {
123  switch (error) {
125  return stream << "SUCCESS";
127  return stream << "UNKNOWN_ERROR";
129  return stream << "AUTHORIZATION_FAILED";
131  return stream << "UNAUTHORIZED_CLIENT";
133  return stream << "SERVER_ERROR";
135  return stream << "INVALID_REQUEST";
137  return stream << "INVALID_VALUE";
139  return stream << "AUTHORIZATION_EXPIRED";
141  return stream << "UNSUPPORTED_GRANT_TYPE";
143  return stream << "INVALID_CODE_PAIR";
145  return stream << "AUTHORIZATION_PENDING";
147  return stream << "SLOW_DOWN";
149  return stream << "INTERNAL_ERROR";
151  return stream << "INVALID_CBL_CLIENT_ID";
152  }
153  return stream << "Unknown AuthObserverInterface::Error!: " << error;
154 }
155 
156 } // namespace sdkInterfaces
157 } // namespace avsCommon
158 } // namespace alexaClientSDK
159 
160 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_AUTHOBSERVERINTERFACE_H_
The authorization code is invalid, expired, revoked, or was issued to a different client...
An unknown body containing no error field has been encountered.
std::ostream & operator<<(std::ostream &stream, const AudioInputProcessorObserverInterface::State &state)
Definition: AudioInputProcessorObserverInterface.h:86
State
The enum State describes the state of authorization.
Definition: AuthObserverInterface.h:34
virtual void onAuthStateChange(State newState, Error error)=0
Error
The enum Error encodes possible errors which may occur when changing state.
Definition: AuthObserverInterface.h:46
Authorization failed in a manner that cannot be corrected by retry.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Invalid code pair provided in Code-based linking token request.
The request is missing a required parameter, has an invalid value, or is otherwise improperly formed...
Client should slow down in the rate of requests polling for an access token.

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