Apollon77 / alexa-cookie

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

Alexa-cookie v3.2.1 for alexa.amazon.co.jp #45

Closed naka-kazz closed 4 years ago

naka-kazz commented 4 years ago

Thank you for updateing Alexa-cookie for Japanese Alexa users. I updated alexa-cookie modules on my node-red. But, node-red could not get alexa-cookie from alexa.amazon.co.jp.

I read source code of v3.2.1, I found new parameter "baseAmazonPage". But, changing initialUrl and exit condition are needed for alexa.amazon.co.jp.

BR.

Apollon77 commented 4 years ago

Which changes are missing? Or does "just" need the node-red module use the new parameter?

naka-kazz commented 4 years ago

I could not find input box for "baseAmazonPage" in screen of Alexa-remote2 on node-red. So, I set "baseAmazonPage=amazon.co.jp" in alexa-cookie.js. And, open http://ipaddr:3456/ on my browser, the page not found screen was shown from www.amazon.co.jp.

I think, individual initialUrl and exit condition are needed for Japanese user.

Individual is const initialUrl = https://www.amazon.co.jp/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.co.jp%2F&openid.identity=http%3A%2F%2\ Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_jp&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.n\ et%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&;

Exit condition is (proxyRes.headers.location && proxyRes.headers.location.includes('/spa/index.html'))

Thank you.

Apollon77 commented 4 years ago

But the baseUrl should in initUrl: https://github.com/Apollon77/alexa-cookie/blob/master/lib/proxy.js#L140 also the exit condition has the baseUrl in it https://github.com/Apollon77/alexa-cookie/blob/master/lib/proxy.js#L253 ... so what exactly is missing in the library? Or do just the node-red module needs an update to Use the new parameter?

naka-kazz commented 4 years ago

The URL parameters of the initiURL are different between www.amazon.com and www.amazon.co.jp. And, we need "alexa.amazon.co.jp/spa/index.html" for a exit condition.

Apollon77 commented 4 years ago

Hm ... not good

Apollon77 commented 4 years ago

Will think

Apollon77 commented 4 years ago

please try 3.3.0 again