Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Authorizing questions #36

Closed
zx-stark opened this issue Jun 26, 2017 · 1 comment
Closed

Authorizing questions #36

zx-stark opened this issue Jun 26, 2017 · 1 comment
Assignees

Comments

@zx-stark
Copy link

zx-stark commented Jun 26, 2017

Hi friends,

  1. There are 7 steps in the Procedure for Obtaining Refresh and Access Tokens. Dose AVS SDK 0.4 realize from step 6, and we should realize the first 5 steps?(https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or-ios-mobile-app)

  2. TEST_F(AlexaAuthorizationDelegateTest, refreshAuthToken) fail, could you tell me why?
    ...
    [ RUN ] AlexaAuthorizationDelegateTest.refreshAuthToken
    ConfigurationNode:initializeSuccess:configuration=redacted
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=0
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=798
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=2803
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=3106
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=10162
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=16145
    HttpPost:doPostSucceeded:code=400
    AuthDelegate:handleLwaResponseFailed:error=unauthorized_client,isUnrecoverable=false
    AuthDelegate:calculatedTimeToRetry:delayMs=39762
    /work/code/r16midea/alexa-client-sdk-master/Integration/test/AlexaAuthorizationDelegateTest.cpp:83: Failure
    Value of: tokenRefreshed
    Actual: false
    Expected: true
    Refreshing the auth token timed out.
    [ FAILED ] AlexaAuthorizationDelegateTest.refreshAuthToken (60040 ms)
    ...

@scotthea-amazon
Copy link
Contributor

Hello zx-stark,

Unfortunately the C++ SDK does not yet include example code for authorizing with a companion app. Instead, the AuthDelegate component of the C++ SDK includes example code for step 7 of authorizing with companion web site

To implement authorizing with a companion app, you currently need your own client device side code to implement the following:

  • Step 1/2, field requests from the companion app (Step 1) and then (step 2) return the required product metadata to the companion app.
  • Step 5/6/7, field requests from the companion app (step 5) that provide the client device with the information needed to request authorization from LWA, then (step 6) make the initial request to LWA, and (step 7) receive and process the reply from LWA.
  • Step 9/10, make requests to LWA to refresh the authorization token. This existing AuthDelegate code can be used to implement this with a minor modification. The code for reading the client_secret from the configuration and sending it in the request to LWA should be removed.

You can look at the Java sample app for examples of implementing steps 1/2 and 5/6/7.

Please let us know if you have further questions,
-SWH

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants