Apollon77 / alexa-cookie

Library to generate a cookie including a csrf for alexa remote
MIT License
36 stars 13 forks source link

Documentation - how to run this? #109

Closed SPGremlin closed 1 year ago

SPGremlin commented 1 year ago

Pardon for the noob question, but could you please provide a few notes of documentation on how to get this to run?

I figured out I need to have node.js installed (I have tried versions 16.x and 19.x) and run "node example.js".

Unfortunately, it fails: /Users/dmitriy.alergant/aws/alexa-cookie-4.1.3/example/example.js:24 formerRegistrationData: { ... } // optional/preferred: provide the result object from subsequent proxy usages here and some generated data will be reused for next proxy call too ^ SyntaxError: Unexpected token '}'

Thanks!

I saw your other project alexa-cookie-cli, but prefer not to run unknown binaries.

Apollon77 commented 1 year ago

This is a library, so there is no full running example because it is meaned to be used in other programs.

So in fact check out alexa-cookie-cli ... I think you could also install it via npm and run node cli.js ... and you can read the code to see what it does. This is more simple

SPGremlin commented 1 year ago

Thanks! I got it.

One more thing, more of a piece of advice to the community (looking to automate things with Alexa). I realized many / most of us probably don't need to run Alexa from our primary Amazon accounts, unless you are really leveraging Alexa's integration with Amazon shopping. I went ahead and reset all Echos to use the new dummy Amazon account that will be low-security (no credit cards attached, no AWS root, etc). It still covers all of the primary use cases (plays music, integrates with smart home, asks weather, etc) - but makes it much easier to handle security credentials for remote integration. Hope this consideration helps someone.


Best regards, Dmitriy

On Wed, Oct 26, 2022 at 2:35 AM Ingo Fischer @.***> wrote:

Closed #109 https://github.com/Apollon77/alexa-cookie/issues/109 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Apollon77/alexa-cookie/issues/109#event-7669695987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXAS3BPUBT3JEHVMTB64CDWFDGL7ANCNFSM6AAAAAARORVXJA . You are receiving this because you authored the thread.Message ID: @.***>

Apollon77 commented 1 year ago

If you really want to automate things then honestly alexa-cookie is most likely the wrong option and youz should check alexa-remote (which uses alexa-cookie under the hood too), but it is also "API" library.

SPGremlin commented 1 year ago

I got it that alexa-remote-control.sh is for automation, but it needs REFRESH_TOKEN - which I'm obtaining manually (one-time) by running alexa-cookie-cli as a proxy, to put its value into the alexa-remote-control configuration. Am I missing something, is there a better way?

I see that you also have alexa-remote library but it's node.js and I'm not a node guy, so shell works best for the time being. Really only looking for the volume control commands.

My Use-Case is

Both pieces already work (can query the TV volume and set Echo Link volume), only remains to correctly automate the scaffolding in-between (while also making sure not to spam Amazon with too many API calls) and put it on a Raspberry PI.


Best regards, Dmitriy

On Wed, Oct 26, 2022 at 8:26 AM Ingo Fischer @.***> wrote:

If you really want to automate things then honestly alexa-cookie is most likely the wrong option and youz should check alexa-remote (which uses alexa-cookie under the hood too), but it is also "API" library.

— Reply to this email directly, view it on GitHub https://github.com/Apollon77/alexa-cookie/issues/109#issuecomment-1291955961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXAS3CYNXMDJLWXHHL4YK3WFEPOJANCNFSM6AAAAAARORVXJA . You are receiving this because you authored the thread.Message ID: @.***>

Apollon77 commented 1 year ago

If shell script works for you then have fun with it :-) All fine.

SPGremlin commented 1 year ago

Awesome, thanks for your help and your development efforts!


Best regards, Dmitriy

On Wed, Oct 26, 2022 at 8:38 AM Ingo Fischer @.***> wrote:

If shell script works for you then have fun with it :-) All fine.

— Reply to this email directly, view it on GitHub https://github.com/Apollon77/alexa-cookie/issues/109#issuecomment-1291970896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMXAS3GKB2OIPCYDEUDCC2TWFEQ5DANCNFSM6AAAAAARORVXJA . You are receiving this because you authored the thread.Message ID: @.***>