New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alexa-cookie2

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexa-cookie2

Generate Cookie and CSRF for Alexa Remote

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-8.68%
Maintainers
1
Weekly downloads
 
Created
Source

Library to generate/retrieve a cookie including a csrf for alexa remote

License

Description

This library can be used to get the cookies needed to access Amazon Alexa services from outside. It authenticates with Amazon and gathers all needed details. These details are returned in the callback. If the automatic authentication fails (because of security checks from amazon like a needed Captcha or because you enabled two factor authentication) the library can also setup a proxy server to allow the manual login and will catch the cookie by itself. Using this proxy you can enter needed 2FA codes or solve captchas and still do not need to trick around to get the cookie.

Example:

const alexaCookie = require('alexa-cookie2');

const options = { // options is optional at all
    logger: console.log,       // optional: Logger instance to get (debug) logs
    amazonPage: 'amazon.com',  // optional: possible to use with different countries, default is 'amazon.de'
    alexaServiceHost: 'pitangui.amazon.com',  // optional: possible to use with different countries, default is 'layla.amazon.de'
    acceptLanguage: 'en-US',   // optional: webpage language, should match to amazon-Page, default is 'de-DE'
    userAgent: '...',          // optional: own userAgent to use for all request, overwrites default one
    setupProxy: true,          // optional: should the library setup a proxy to get cookie when automatic way did not worked? Default false!
    proxyOwnIp: '...',         // required if proxy enabled: provide own IP or hostname to later access the proxy. needed to setup all rewriting and proxy stuff internally
    proxyPort: 3456,           // optional: use this port for the proxy, default is 0 means random port is selected
    proxyListenBind: '0.0.0.0',// optional: set this to bind the proxy to a special IP, default is '0.0.0.0'
    proxyLogLevel: 'info'      // optional: Loglevel of Proxy, default 'warn'
}

alexaCookie.generateAlexaCookie('amazon@email.de', 'amazon-password', config, (err, result) => {
    // IMPORTANT: can be called multiple times!! As soon as a new cookie is fetched or an error happened. Consider that!
    console.log('RESULT: ' + err + ' / ' + JSON.stringify(result));
    if (result && result.csrf) {
        alexaCookie.stopProxyServer();
    }
});

Thanks:

A big thanks go to soef for the initial version of this library.

Partly based on Amazon Alexa Remote Control (PLAIN shell) and alexa-remote-control and the the Proxy idea from OpenHab-Addon Thank you for that work.

Changelog:

1.0.1

  • (Apollon77) better handle errors in automatic cookie generation

1.0.0

  • (Apollon77) handle Amazon change

0.2.x

  • (Apollon77) 0.2.2: fix encoding of special characters in email and password
  • (Apollon77) 0.2.1: Cleanup to prepare release
  • (Apollon77) 0.2.0: Add option to use a proxy to also retrieve the credentials if the automatic retrieval fails
  • (Apollon77) 0.2.0: Optimize automatic cookie retrieval, remove MacOS user agent again because the Linux one seems to work better

0.1.x

  • (Apollon77) 0.1.3: Use specific User-Agents for Win32, MacOS and linux based platforms
  • (Apollon77) 0.1.2: Log the used user-Agent, Accept-Language and Login-URL
  • (Apollon77) 0.1.1: update to get it working again and sync to alexa-remote-control

0.0.x

  • Versions by soef

Keywords

FAQs

Package last updated on 11 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc