![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
alexa-cookie2
Advanced tools
Library to generate/retrieve a cookie including a csrf for alexa remote
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.
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();
}
});
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.
FAQs
Generate Cookie and CSRF for Alexa Remote
The npm package alexa-cookie2 receives a total of 1,436 weekly downloads. As such, alexa-cookie2 popularity was classified as popular.
We found that alexa-cookie2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.