Apollon77 / alexa-cookie

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

Proxy return 404 #129

Closed niemand108 closed 10 months ago

niemand108 commented 10 months ago

I'm on Linux using your example.js, changing params to "amazon.es" but the proxy returns a 404 error. Neither works with amazon.de:

Suchst du etwas? Tut uns leid: Die Web-Adresse, die du eingegeben hast, gibt es auf unserer Website nicht. Zur Amazon.de

Screenshot from 2023-11-06 19-28-53

I'm trying some things. In the browser I can get the amazon main web only if I add a double slash to end of the url http://0.0.0.0:33456// but or it mess up the relative links, or links point https://0.0.0.0 (and the proxy only support http, not https), or the amazon web say I have cookies disabled. Also, what's the point of this attemps? :D

My config:

const config = { logger: console.log, amazonPage: 'amazon.de', // optional: possible to use with different countries, default is 'amazon.de' //acceptLanguage: 'es-ES', // optional: webpage language, should match to amazon-Page, default is 'de-DE' //userAgent: '...', // optional: own userAgent to use for all request, overwrites default one, should not be needed proxyOnly: true, // optional: should only the proxy method be used? When no email/password are provided this will set to true automatically, default: false setupProxy: true, // optional: should the library setup a proxy to get cookie when automatic way did not worked? Default false! proxyOwnIp: '0.0.0.0', // required if proxy enabled: provide own IP or hostname to later access the proxy. needed to setup all rewriting and proxy stuff internally proxyPort: 33456, // 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: 'debug', // optional: Loglevel of Proxy, default 'warn' baseAmazonPage: 'amazon.de', // optional: Change the Proxy Amazon Page - all "western countries" directly use amazon.com including australia! Change to amazon.co.jp for Japan //amazonPageProxyLanguage: 'es_ES', // optional: language to be used for the Amazon Sign-in page the proxy calls. default is "de_DE") //deviceAppName: '...', // optional: name of the device app name which will be registered with Amazon, leave empty to use a default one //formerDataStorePath: '...', // optional: overwrite path where some of the formerRegistrationData are persisted to optimize against Amazon security measures //formerRegistrationData: { ... }, // optional/preferred: provide the result object from subsequent proxy usages here and some generated data will be reused for next proxy call too //proxyCloseWindowHTML: '...' // optional: use in order to override the default html displayed when the proxy window can be closed, default is 'Amazon Alexa Cookie successfully retrieved. You can close the browser.' };

Apollon77 commented 10 months ago

hey,

1.) Ideally try to leave all optional parameters as is and not set them! 2.) only set the locale to "es-ES" but you need to remove the // because else it is commented out and not effective

When the error comes? Directly when you open/call the initial URL?

niemand108 commented 10 months ago

Well, trying to not set optional parameters related to proxy it works (now I see a qr code).

Setting again the parameters (once a at time), the problem rise when setting 'proxyOwnIp', the IP setted there not works. That was the issue.

For example:

proxyOwnIp : '127.0.0.1' proxyListenBind: '0.0.0.0'

0.0.0.0 works, 127.0.0.1 it doesnt.

If both are the same IP, then amazon/proxy returns a 404.

Something is wrong with 'proxyOwnIp'.

Thx!

Apollon77 commented 10 months ago

"proxyOwnIp" is used for casses where this lib eg runs in a docker environment that has a different IP then the local one. so if you do not need it simple do not use it please