node-red-contrib-alexa-remote2 icon indicating copy to clipboard operation
node-red-contrib-alexa-remote2 copied to clipboard

Unexpected end of JSON input when trying to initialise the account

Open wizy69 opened this issue 4 years ago • 17 comments

on a clean install, using proxy authentication. After I open the requested browser session to generate the cookie( message confirmed) . Account therefore does not initialise

Syntax error on screen, debug: node: 146d4052.3ded4 msg : string[28] "Unexpected end of JSON input"

Have tried other authentiction (cookies and proxy) same result. Even after node red restart. Node red latest on Home Assist Virtual Env AU Country utilised. Even tried others (interesting that authentication still produce positive cookie message?

wizy69 avatar Jan 09 '21 13:01 wizy69

Same problem here.

mainres07 avatar Jan 10 '21 14:01 mainres07

Same here for an AUS account.. Same error using the init flow

EDIT: definitely a aussie account issue!! When i use my USA alexa details it works!!

bdydrp avatar Jan 10 '21 23:01 bdydrp

I managed to get it to work. Did a new machine and started from scratch install of HA as there was an issue with Supervisor Logs ( not sure if related). Got it working by using cookies method, And guidelines explained https://www.youtube.com/watch?v=Yg7dv4OOFAY&t=742s, 12:40 onwards on getting cookie. Also, don't inject right away. Once the routine account settings are updated, wait for it ti display "Ready" under the routine. Then it should have initialized and device can be selected. So to summarise, have timestamp inject and Alexa Routine Mode Nodes. On the routine node, i have auth method: cookie selected; cookie text copied from and including session-id= text; auto :on , events:on, service:alexa.amazon.com.au; page: amazon.com.au Will need to see how long before cookie gets refresehd, and will check other examples where cookies autorefreshed

wizy69 avatar Jan 11 '21 02:01 wizy69

Manual cookie method will work, but it wont auto update. After 4-5 days you will need to manually refresh the cookie

bdydrp avatar Jan 11 '21 02:01 bdydrp

Even Manual cookie failed after a while ( suspect account password change), even if new cookie manually sourced through another browser session. Have reverted to email/password authentication ( no 2fa) and working so-far. I suspect there is no cokkie being passed or generated via the nodered proxy authentication method, as logs show error: Unexpected token s in JSON at position 0. If the cokkie session is being passed back is blank , or jsonwrite command is empty it will cause a JSON failed error. Any luck getting this to work for others using 2fa?

wizy69 avatar Jan 17 '21 00:01 wizy69

If use my American Amazon account, it generates a cookie, so I know my init flow works. I dont know how the 2 account cookies are different, but there must be something

On Sun, 17 Jan. 2021, 11:37 am wizy69, [email protected] wrote:

Even Manual cookie failed after a while ( suspect account password change), even if new cookie manually sourced through another browser session. Have reverted to email/password authentication ( no 2fa) and working so-far. I suspect there is no cokkie being passed or generated via the nodered proxy authentication method, as logs show error: Unexpected token s in JSON at position 0. If the cokkie session is being passed back is blank , or jsonwrite command is empty it will cause a JSON failed error. Any luck getting this to work for others using 2fa?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/586837r/node-red-contrib-alexa-remote2/issues/187#issuecomment-761705485, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFF2ZAVVQ4TDNMHSFTD6R3S2IWODANCNFSM4V3SJMVQ .

bdydrp avatar Jan 17 '21 01:01 bdydrp

I'm getting the same with UK account, and also this message sometimes:

image

877dev avatar Jan 25 '21 15:01 877dev

Same here, UK account. It started happening multiple times a day during January. I have been using an hourly Refresh and Re-Init (copied from someone else here a while ago). image Interestingly "Restart Flows" sometimes succeeds in login, but not always. Not sure why restarting flows should work.

GurjBahia avatar Jan 26 '21 09:01 GurjBahia

Same here, IT Account.

Same here, UK account. It started happening multiple times a day during January. I have been using an hourly Refresh and Re-Init (copied from someone else here a while ago). image Interestingly "Restart Flows" sometimes succeeds in login, but not always. Not sure why restarting flows should work.

Hi, @GurjBahia could you please share here the code for the Refresh and the Re-Init? Thanks!

mcarame avatar Jan 26 '21 11:01 mcarame

Same here, IT Account.

Same here, UK account. It started happening multiple times a day during January. I have been using an hourly Refresh and Re-Init (copied from someone else here a while ago). image Interestingly "Restart Flows" sometimes succeeds in login, but not always. Not sure why restarting flows should work.

Hi, @GurjBahia could you please share here the code for the Refresh and the Re-Init? Thanks!

[{"id":"e1fe367f.c0c468","type":"alexa-remote-init","z":"8dfc23dd.12d368","name":"","account":"","option":"refresh","x":640,"y":1320,"wires":[["6b036a0e.0ec07c"]]},{"id":"95e9d8e0.ec142","type":"inject","z":"8dfc23dd.12d368","name":"1hr Refresh","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":1320,"wires":[["e1fe367f.c0c468"]]},{"id":"f35507e7.5b5258","type":"catch","z":"8dfc23dd.12d368","name":"Catch Refresh Errors","scope":["95e9d8e0.ec142"],"uncaught":false,"x":470,"y":1400,"wires":[["f03ef29e.ecf8b"]]},{"id":"f03ef29e.ecf8b","type":"alexa-remote-init","z":"8dfc23dd.12d368","name":"","account":"","option":"fresh","x":720,"y":1400,"wires":[["2aa8eaf1.8eb296"]]},{"id":"2aa8eaf1.8eb296","type":"debug","z":"8dfc23dd.12d368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":990,"y":1400,"wires":[]},{"id":"6b036a0e.0ec07c","type":"debug","z":"8dfc23dd.12d368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":990,"y":1320,"wires":[]},{"id":"988670bd.17836","type":"inject","z":"8dfc23dd.12d368","name":"Manual","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":430,"y":1480,"wires":[["f03ef29e.ecf8b"]]}]

Corrected title of Manual image

GurjBahia avatar Jan 26 '21 20:01 GurjBahia

Same here, IT Account.

Same here, UK account. It started happening multiple times a day during January. I have been using an hourly Refresh and Re-Init (copied from someone else here a while ago). image Interestingly "Restart Flows" sometimes succeeds in login, but not always. Not sure why restarting flows should work.

Hi, @GurjBahia could you please share here the code for the Refresh and the Re-Init? Thanks!

[{"id":"e1fe367f.c0c468","type":"alexa-remote-init","z":"8dfc23dd.12d368","name":"","account":"","option":"refresh","x":640,"y":1320,"wires":[["6b036a0e.0ec07c"]]},{"id":"95e9d8e0.ec142","type":"inject","z":"8dfc23dd.12d368","name":"1hr Refresh","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":1320,"wires":[["e1fe367f.c0c468"]]},{"id":"f35507e7.5b5258","type":"catch","z":"8dfc23dd.12d368","name":"Catch Refresh Errors","scope":["95e9d8e0.ec142"],"uncaught":false,"x":470,"y":1400,"wires":[["f03ef29e.ecf8b"]]},{"id":"f03ef29e.ecf8b","type":"alexa-remote-init","z":"8dfc23dd.12d368","name":"","account":"","option":"fresh","x":720,"y":1400,"wires":[["2aa8eaf1.8eb296"]]},{"id":"2aa8eaf1.8eb296","type":"debug","z":"8dfc23dd.12d368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":990,"y":1400,"wires":[]},{"id":"6b036a0e.0ec07c","type":"debug","z":"8dfc23dd.12d368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":990,"y":1320,"wires":[]},{"id":"988670bd.17836","type":"inject","z":"8dfc23dd.12d368","name":"Manual","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":430,"y":1480,"wires":[["f03ef29e.ecf8b"]]}]

Corrected title of Manual image

Thank you very much!

mcarame avatar Jan 27 '21 06:01 mcarame

Try this flow: this flow checks if account is not initialized and rejoins automagically. https://github.com/driagi/node-red-contrib-alexa-remote2

elchanly avatar Feb 03 '21 21:02 elchanly

Anyone know how to debug to try see what is causing the issue, or which file is used in initiating the routine so that I can debug further. I want to return the cokkie txt or see where it is converting to JSON Input to see if its a character limit or perhaps it does not need to e converted

wizy69 avatar Mar 09 '21 19:03 wizy69

Anyone know how to debug to try see what is causing the issue, or which file is used in initiating the routine so that I can debug further. I want to return the cokkie txt or see where it is converting to JSON Input to see if its a character limit or perhaps it does not need to e converted

I know this is old, but did you ever have any luck debugging this?

nrout-HA avatar Mar 07 '22 01:03 nrout-HA

Same for me AU. Any solutions?

abphd avatar Aug 22 '22 04:08 abphd

Same for me AU. Any solutions?

Update to the applestrudel fork! This works with au accounts. Mine has been working flawless for 3 weeks now

bdydrp avatar Aug 23 '22 03:08 bdydrp

Issue went away not sure if latest version resolved or host software update resolved issue

Sent from Yahoo Mail for iPhone

On Tuesday, August 23, 2022, 13:30, bdydrp @.***> wrote:

Same for me AU. Any solutions?

Update to the applestrudel fork! This works with au accounts. Mine has been working flawless for 3 weeks now

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

wizy69 avatar Aug 23 '22 07:08 wizy69