dgthomson / nodered-shellrecharge

A subflow for Nodered to control Shell Recharge car charging equipment.
GNU General Public License v3.0
20 stars 7 forks source link

403 Forbidden Error with 2.5 #27

Closed yoannHertienne closed 2 months ago

yoannHertienne commented 2 months ago

Hello,

Thank you for proposing this node red subflow, very usefull.

I checked your github page one month ago, after receiving the 403 error, and I upgraded to the version 2.5 accordingly.

Everything was working fine until this week where I'm receiving following payload with version 2.5

403 Forbidden

403 Forbidden

image

Are you aware ? any new release planned ?

dgthomson commented 2 months ago

Yes, there is a problem- not sure why yet. As a matter of interest, have you upgraded to Node-RED 4?

PieDamen commented 2 months ago

Also Having this issue since upgrade to node-red 4.

dgthomson commented 2 months ago

Also Having this issue since upgrade to node-red 4.

Thanks. The subflow can't download the account.shellrecharge.com webpage which it needs to start logging in, getting a 403: Forbidden error. I can run it on a Node-RED 3.1.10 installation no problem so probably something has changed in Node-RED 4's behaviour. I'll keep looking. My guess is that it's an HTTPS issue as I get something similar on my laptop:

dgt@MBAir ~ % curl account.shellrecharge.com
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
dgt@MBAir ~ %

Advice at the moment is not to upgrade to Node-RED 4.

yoannHertienne commented 2 months ago

Yes, there is a problem- not sure why yet. As a matter of interest, have you upgraded to Node-RED 4?

Yes, I'm using Node red 18.0.0 plugin which is implementing Node-Red V4.0.

But I cannot confirm the issue started again when node red was upgrade to V4.0 (upgrade done June 22th, so 2 days ago), but seems to be a potential reason, because it was working before

dgthomson commented 2 months ago

This seems to be the issue. I'll try to get a revised version out soon.

dgthomson commented 2 months ago

I've uploaded a new version here with a possible fix if anyone's up for testing it.

Cmbeek commented 2 months ago

sr-2-50-NR4FIX.json worked for me. Replaced the old version of the shellrecharge node by this one and everything seems up and running correctly. Thanks a million for your Quick update!

PieDamen commented 2 months ago

thanks for the quick fix! Seems to be working again. However i'm getting an error: no token.

seeing:

jQuery('#'+"login-error").html("Incorrect e-mail or password"); App.UI.show('#login-error', false, 3000); if (document.getElementById("login-pwd")) {document.getElementById("login-pwd").value = "";};

but i'm sure the credentials are correct.

dgthomson commented 2 months ago

thanks for the quick fix! Seems to be working again. However i'm getting an error: no token.

seeing:

jQuery('#'+"login-error").html("Incorrect e-mail or password"); App.UI.show('#login-error', false, 3000); if (document.getElementById("login-pwd")) {document.getElementById("login-pwd").value = "";};

but i'm sure the credentials are correct.

not sure. the fix is literally changing the phrase User-Agent to user-agent internally so if it was working for you before then I can't explain this issue, sorry.

PieDamen commented 2 months ago

thanks for the quick fix! Seems to be working again. However i'm getting an error: no token. seeing: jQuery('#'+"login-error").html("Incorrect e-mail or password"); App.UI.show('#login-error', false, 3000); if (document.getElementById("login-pwd")) {document.getElementById("login-pwd").value = "";}; but i'm sure the credentials are correct.

not sure. the fix is literally changing the phrase User-Agent to user-agent internally so if it was working for you before then I can't explain this issue, sorry.

the oddest thing. if i put my credentials in the subflow itself, it's working :)

image

yoannHertienne commented 2 months ago

thanks for the quick fix! Seems to be working again. However i'm getting an error: no token. seeing: jQuery('#'+"login-error").html("Incorrect e-mail or password"); App.UI.show('#login-error', false, 3000); if (document.getElementById("login-pwd")) {document.getElementById("login-pwd").value = "";}; but i'm sure the credentials are correct.

not sure. the fix is literally changing the phrase User-Agent to user-agent internally so if it was working for you before then I can't explain this issue, sorry.

the oddest thing. if i put my credentials in the subflow itself, it's working :)

image

Same issue for me "Error! No token." and putting the credential in subflow works

dgthomson commented 2 months ago

I think this is another Node-RED 4.0.0 thing.

If I type my password into the Shell Recharge subflow instance properties box alongside my e-mail address, deploy, then have another look at the subflow instance properties box, the password has gone. So there's actually no password being sent over the internet so it fails.

Can someone else confirm this behaviour? I'll escalate to the Node-RED devs if so.

Workaround will be to add the password directly into the subflow as @PieDamen has done.

Cmbeek commented 2 months ago

I think this is another Node-RED 4.0.0 thing.

If I type my password into the Shell Recharge subflow instance properties box alongside my e-mail address, deploy, then have another look at the subflow instance properties box, the password has gone. So there's actually no password being sent over the internet so it fails.

Can someone else confirm this behaviour? I'll escalate to the Node-RED devs if so.

Workaround will be to add the password directly into the subflow as @PieDamen has done.

I tried your sequence: Re-entered email address and password and pressed deploy. Flow kept on working (checked this by starting , stopping en polling de sub-flow) and email and password did not disappear.

Maybe this helps, maybe it doesn't (i don't have a clue about the programming): I did not import the complete the sr-2-50-NR4FIX.json file. During importing the file Nodered asked me if i wanted to add the file or only replace the new sub-flows. I selected the replace option.

dgthomson commented 2 months ago

The two issues in Node-RED 4.0.0 relevant to these bugs (here and here) have been fixed in maintenance release 4.0.1 so if you upgrade to this version the problems should go away. If you're using the sr-2-50-NR4FIX.json version of the subflow there's no particular reason to go back to the un-fixed version as it will carry on working so save yourself the bother.