question

nathanmani avatar image
nathanmani asked

Automation for Authorizing a Device to Access the AVS without Web Browser

Is it possible to authenticate a session without having web browser and entering the data manually into the "login to amazon" page? I have tried automation for login into “login to amazon" page using libCURL APIs. But the automate login was failed and the response page received for HTTP posting is showing the warning messages as “Please Enable Cookies to Continue”. Please can you share if any one has idea/sample code
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

H. Jones avatar image
H. Jones answered
Nathan, I'd be happy to help but I'm not sure I understand what you are trying to do. What's your use case? Can you explain your issue in more detail?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nathanmani avatar image
nathanmani answered
Thank you H. Jones … We are trying to port AVS functionality on some embedded platform running on Linux. The platform will not have display and web browser support. For AVS, first user has to login to our website (redirected to amazon) to get Access token. As we do not have web browser + display on this platform, we are trying to use some script/code which do auto login without browser and entering data manually. We have tried using libCURL i/f APIs for auto login. But it failed due to JAVA script cookies by Amazon web site. Please can you help us on the above scenario?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

H. Jones avatar image
H. Jones answered
So is the issue here associating the device with the Amazon account and not associating the Alexa user with the Amazon account (they obviously have a browser)? My suggestion would be to build some kind of relationship between the device and the associated user account. How do you currently control this AVS device? My suggested flow (with my limited understanding of your setup): 1. User setups the device and (somehow) the device displays a pin / ID of some kind 2. User goes online to a web interface, logs in with Amazon, and inputs the PIN. Now you have a association between Amazon user and device. 3. User then goes into Alexa app and enables your adapter. They again login and now your lambda code can receive events from them (for device discovery, turn on/off, etc). 4. User performs device discovery. Your lambda code is called. It looks up that Amazon user and then looks to see what devices that user owns. It returns with a list. 5. User performs a device control. Your lambda code is called. It looks up that device and performs the device control function on it (somehow) Does that above flow work for your application?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

elstryan@Amazon avatar image
elstryan@Amazon answered
Thank you Jones and nathanmani for your interest in AVS! The approach I'm going to recommend is somewhat in line with what Jones said above. I'd recommend that you take a look at the reference implementation here: https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/reference-implementation-guide#Running%20the%20Server. I believe the sample implements much of what you're looking for. The sample server would be the web interface that Jones referred to above. If you use the sample you don't need to worry about hooking up with lambda the sample server will handle passing a token to the AVS device. The only modification that you will need to be careful of is in the sample the AVS device displays a pop-up with a url and the user cuts this url and pastes it into a browser, since your device doesn't have an graphical display you'll need a slightly different route. Something along the lines of what Jones mentioned should be fine - if your device has some kind of serial number you can use this on the server to associate the device with the account.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nathanmani avatar image
nathanmani answered
Thanks you so much elstryan.. As you guys suggested, we are plan to use a sample server application( we will modify as per our requirement) to control AVS devices .. Also we will use serial number of the platform on server as weell as on client associate the device with the account.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.