Giter Site home page Giter Site logo

alexa-cookie-cli's Introduction

alexa-cookie-cli

Binary of https://github.com/Apollon77/alexa-cookie (using pkg - https://github.com/vercel/pkg), get the latest release here.

Without any further ado this will open a proxy of the Amazon login page on http://127.0.0.1:8080.

ATTENTION: without any options, the app is pre-programmed for a German Amazon account!

Once the login completes successfully, the command window will return the refresh_token required to run alexa_remote_control.sh. The token looks something like Atnr|...

Additional options:

Usage: cli [options]

Options:
  -q, --quiet                                     Non-interactive, output refresh_token on StdOut and exit
  -d, --debug                                     Turn on debug output to StdOut
  -A, --deviceAppName <AppName>                   optional: Name of the Device registered with the Alexa app (default: alexa_cookie_cli)
  -p, --amazonPage <page>                         optional: possible to use with different countries, default is "amazon.de"
  -b, --baseAmazonPage <amazon.com|amazon.co.jp>  optional: Change the Proxy Amazon Page - all "western countries" directly use amazon.com! Change to amazon.co.jp for Japan
  -a, --amazonPageProxyLanguage <lang>            optional: language to be used for the Amazon Sign-in page the proxy calls. default is "de_DE"
  -L, --acceptLanguage <lang>                     optional: webpage language, should match to amazon-Page, default is "de-DE"
  -u, --userAgent <Browser>                       optional: own userAgent to use for all request, overwrites default one, should not be needed
  -H, --proxyOwnIp <IP of localhost>              provide own IP(!) to later access the proxy. needed to setup all rewriting and proxy stuff internally (default: "127.0.0.1")
  -P, --proxyPort <port>                          optional: use this port for the proxy, default is 8080 (default: 8080)
  -B, --proxyListenBind <IP>                      optional: set this to bind the proxy to a special IP, default is "0.0.0.0"
  -h, --help                                      display help for command

For implementation in other projects, the session cookies can be obtained using the refresh_token like this:

POST /ap/exchangetoken/cookies HTTP/1.1
x-amzn-identity-auth-domain: api.amazon.de

requested_token_type=auth_cookies
app_name=Amazon Alexa
domain=www.amazon.de
source_token_type=refresh_token
source_token=Atnr|...

(make sure to URL-encode, etc. !)

alexa-cookie-cli's People

Contributors

adn77 avatar dnlm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

alexa-cookie-cli's Issues

error when used in AU

Hi, I have tried to use this for AU (alexa.amazon.com.au/amazon.com.au) with the following, but always get an error

SyntaxError: Unexpected end of JSON input / null

It look like it always heads to alexa.amazon.com whereas here its alexa.amazon.com.au

node cli.js -H 192.168.1.128 -a en-AU -L en-AU -q -p amazon.com.au -b amazon.com -V debug
[HPM] Proxy created: !/cookie-success -> https://alexa.amazon.com
[HPM] Proxy rewrite rule created: "^/www.amazon.com" ~> ""
[HPM] Proxy rewrite rule created: "^/alexa.amazon.com" ~> ""
[HPM] Subscribed to http-proxy events: [ 'error', 'proxyReq', 'proxyRes', 'close' ]
Error: You can try to get the cookie manually by opening http://192.168.1.128:8080/ with your browser. / null
[HPM] Router new target: https://alexa.amazon.com -> "https://www.amazon.com/ap/signin?openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fap%2Fmaplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2&openid.oa2.client_id=device%3A463430453135354645413931423937363033303132414234383646373842313723413249564c5635564d32573831&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.oa2.response_type=code&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=Q3QK6K0TXzI2198oJ3WZd8rUWjsdNuGWNFYVGNNQab8&language=en-AU"
[HPM] GET / => https://www.amazon.com/ap/signin?openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fap%2Fmaplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2&openid.oa2.client_id=device%3A463430453135354645413931423937363033303132414234383646373842313723413249564c5635564d32573831&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.oa2.response_type=code&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&openid.oa2.code_challenge_method=S256&openid.oa2.code_challenge=Q3QK6K0TXzI2198oJ3WZd8rUWjsdNuGWNFYVGNNQab8&language=en-AU
[HPM] Router new target: https://alexa.amazon.com -> "https://www.amazon.com"
[HPM] GET /ap/uedata?ld&v=0.221671.0&id=ZXZJFWXX5WZ24J0GFGMG&sw=2560&sh=1440&vw=1247&vh=1231&m=1&sc=ZXZJFWXX5WZ24J0GFGMG&ue=2&bb=20&cf=27&be=28&fp=26&fcp=26&pc=64&tc=-1365&na_=-1365&ul_=-1653711630521&ul=-1653711630521&rd=-1653711630521&rd=-1653711630521&fe=-1358&lk_=-1358&lk=-1358&co=-1358&co=-1358&sc=-1653711630521&rq_=-1356&rs_=-15&rs=-9&dl=-8&di_=42&de_=42&_de=42&dc=64&ld=64&_ld=-1653711630521&ntd=-1&ty=0&rc=0&hob=1&hoe=2&ld=65&t=1653711630586&ctb=1&rt=cf:16-8-3-1-3-15-1__ld:17-9-3-1-4-16-1&csmtags=aui|aui:aui_build_date:3.21.8-2022-03-24|fls-na-amazon-com|adblk_no&viz=visible:2&pty=AuthenticationPortal&spty=MobileSignInApplication&pti=undefined&tid=7TEH3S5QMRVKQRG9EP88&aftb=1 => https://www.amazon.com
[HPM] Router new target: https://alexa.amazon.com -> "https://www.amazon.com"
[HPM] GET /ap/uedata?at&v=0.221671.0&id=ZXZJFWXX5WZ24J0GFGMG&ctb=1&m=1&sc=ZXZJFWXX5WZ24J0GFGMG&pc=11339&at=11339&t=1653711641860&csmtags=csm-feature-touch-enabled:false&pty=AuthenticationPortal&spty=MobileSignInApplication&pti=undefined&tid=7TEH3S5QMRVKQRG9EP88&aftb=1 => https://www.amazon.com
[HPM] Router new target: https://alexa.amazon.com -> "https://www.amazon.com"
[HPM] GET /ap/uedata?at&v=0.221671.0&id=ZXZJFWXX5WZ24J0GFGMG&ctb=1&m=1&sc=ZXZJFWXX5WZ24J0GFGMG&pc=11346&at=11346&t=1653711641867&pty=AuthenticationPortal&spty=MobileSignInApplication&pti=undefined&tid=7TEH3S5QMRVKQRG9EP88&aftb=1&ui=2 => https://www.amazon.com
[HPM] Router new target: https://alexa.amazon.com -> "https://www.amazon.com"
[HPM] Rewriting path from "/www.amazon.com/ap/signin" to "/ap/signin"
[HPM] POST /www.amazon.com/ap/signin โ‰ˆ> https://www.amazon.com
SyntaxError: Unexpected end of JSON input / null

Add infos for dummies to readme

Hey, 2 things you could consider to include in the readme:

  1. Hint to start the exe from a command line. I just opened it from explorer and the window closed automatically after fetching the token. (Now that I write this, maybe you could add sth like "press any key to continue" after the token has been fetched so the window doesn't close?)
  2. Link to the latest binary download page. I know the Link is on the right sidebar, but most projects include the link in the readme and I think it's a good idea so people new to github aren't lost (TBH I looked in the text first and was lost for a few seconds ๐Ÿ˜).

I cannot get a refresh token

When running alexa-cookie-cli-macos-x64 on mac os CLI, I cannot get a refresh token.

Atza|... is able to get the refresh token.

What should I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.