gausma / nodered-contrib-signal-client

Signal communicator client nodes for Node-RED
GNU General Public License v3.0
33 stars 13 forks source link

Registration problem #18

Closed pawel3410 closed 3 years ago

pawel3410 commented 3 years ago

After send request-sms or request-voice I get this message and sms code is not send: "Signal client error: {"name":"HTTPError","code":402,"response":"<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n<title>Error 402 Payment Required</title>\n</head>\n<body><h2>HTTP ERROR 402 Payment Required</h2>\n<table>\n<tr><th>URI:</th><td>/v1/accounts/sms/code/+48*********</td></tr>\n<tr><th>STATUS:</th><td>402</td></tr>\n<tr><th>MESSAGE:</th><td>Payment Required</td></tr>\n<tr><th>SERVLET:</th><td>io.dropwizard.jersey.setup.JerseyServletContainer-289cf7db</td></tr>\n</table>\n\n</body>\n</html>\n"}"

baldfox commented 3 years ago

Am also having the same.

FredBlo commented 3 years ago

I have this same issue. Tried with different numbers (which have the Signal app installed correctly) but have the same issue. Wondering if it is related to the fact I am in Europe (does Signal allow registering this way outside of the US?) I found this thread searching for info about the used URL '/v1/accounts/sms/code/', not usre this can be related to how it works within node-red https://github.com/throneless-tech/libsignal-service-javascript/issues/8

asterix555 commented 3 years ago

In some cases signal requires a captcha: https://signalcaptchas.org/registration/generate.html

Fixed in signal-cli in November: https://github.com/AsamK/signal-cli/commit/c3e1d4fc750998a946a5c5b60d705e5eb582afd9

FredBlo commented 3 years ago

I can indeed perform the captcha operation and find back the redirect at the end of the process in the browser's dev tools which is like signalcaptcha://03AGdBq24UEFhfmfq.... (=token)

But no idea how to include such captcha token in current node-red process, I guess the registration node should have to mange a new param but it get quite complex to integrate in the node-red UI...

fanuch commented 3 years ago

It's not implemented yet.

Here is the function -> https://github.com/gausma/nodered-contrib-signal-client/blob/main/src/signal-client.js#L94

The downstream library doesn't support captcha either

fanuch commented 3 years ago

@nadeerck2020 avoid "same" type messages. You notify everyone watching without any value added to the conversation. Use message reactions instead.

nadeerck2020 commented 3 years ago

@fanuch Sorry, i am going to remove it.

max3232rs commented 3 years ago

Hi, I'm also affected. So I went though the whole procedure and added the captcha field. Thanks for the already posted links. Perhaps, it's a little bit quick and dirty. As I'm using a land line number, I didn't test the request-sms, but I tried to patch it also. And as I'm requested for payment every time, I can't check what happens, when it is not needed. I also don't want to fork the whole thing. Perhaps, the patch might be included here, after beeing checked.

cd nodered-contrib-signal-client cat signal-client.patch.txt | patch -b -p0

Hope, it might help.

Onixarts commented 3 years ago

Should I do something after applying the patch and restarting node-red? I see no captcha field in config node.

fanuch commented 3 years ago

Absolute legend @max3232rs. Worked for me (using NR from within a Docker container).

@Onixarts I had to restart my Docker container, so I assume NR needs a reload.

Lastly, @max3232rs your relative paths needed some adjusting as you had ./node_modules/@gausma in the same file as ./src/. Here is my patch as a Gist


My instructions:

  1. Navigate to node_modules directory (you should see a folder called nodered-contrib-signal-client and @gausma)
  2. wget https://gist.githubusercontent.com/fanuch/3814bf00992c8609cf48fb844f22177c/raw/49de43b4f28f639d1abfbb8c5c8753c216ddc937/signal-client.patch to pull my patch
  3. cat signal-client.patch | patch -b -p0
  4. Restart Node Red
max3232rs commented 3 years ago

Hi,

@fanuch I use node-red on a raspberry-pi and the modules has been installed via npm -g i nodered-contrib-signal-client I think, the path structure is different to the "personal" installation without "-g". No idea, how it looks within docker.

@Onixarts restarting node-red is important and I also mentioned, that you have to press Ctrl-F5 in the flow designer (or wipe the browser cache otherwise) to have the changed html visible. The request-voice should look like this (and the request-sms also)

gausma commented 3 years ago

Hi @max3232rs,

I would like to add the captcha functionality. I should understand better how it works because I've never seen this request.

I assume you get an error message in the log. Is the message also output in the debug sidebar? What does the message look like? Can you send an axample for the readme?

Can you please explain where the captch string you entered in the screenshot comes from?

Onixarts commented 3 years ago

Yes it is in the debug sidebar, after requesting sms code, comming from the node itself (not debug node).

Signal client error: {"name":"HTTPError","code":402,"response":"<html>\n<head>\n<meta http-equiv=\"Content-Type\"
 content=\"text/html;charset=utf-8\"/>\n<title>Error 402 Payment Required</title>\n</head>\n<body><h2>HTTP ERROR 402 
Payment Required</h2>\n<table>\n<tr><th>URI:</th><td>/v1/accounts/sms/code/+48*********</td></tr>\n<tr>
<th>STATUS:</th><td>402</td></tr>\n<tr><th>MESSAGE:</th><td>Payment Required</td></tr>\n<tr><th>SERVLET:
</th><td>io.dropwizard.jersey.setup.JerseyServletContainer-*******</td></tr>\n</table>\n\n</body>\n</html>\n"}
Onixarts commented 3 years ago

Captcha code, found on the Home Assistant github

https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/HOMEASSISTANT.md

When you try to register a number, if you receive a response like {"error":"Captcha required for verification (null)\n"} then Signal is requiring a captcha. To register the number you must do the following (in Mozilla Firefox):

Go to https://signalcaptchas.org/registration/generate.html Open the developer console Answer the captcha On the developer console, find the line that looks like this: Prevented navigation to “signalcaptcha://{captcha value}” due to an unknown protocol. Copy the captcha value

After received sms code I've put it into register node. But it looks like registering my phone number in node-red cause my desktop and android phone clients unregisters. I can't make this work.

FredBlo commented 3 years ago

I applied the patch @max3232rs created. The pacth execution failed for me on the 2 last files ('AccountManager.js' and 'WebAPI.js') but was OK for the others. Not clear to me why it had a HUNK error, all paths,.. looked OK. Anyway, I applied the changes manually and its works now (by getting the captcha info from debugger pane indeed, as explained by @Onixarts).

Thanks !

@Onixarts : the register process does not allow adding a new device. It re-registers an account from scratch, disconnecting all others. The procedure to add a device exists but seems very different (and requires both devices to be able to 'talk' with each other to ensure Peer-to-Peer coherent encryption is OK (as far as I understood it).

max3232rs commented 3 years ago

Hi, @gausma I nearly have nothing to add to @Onixarts . I got also this message in debug pane and also on syslog (depending on startup, I run node-red with systemd as service, so I get it within journalctrl -u node-red) Normal behaviour, I think, as you use sendError here: https://github.com/gausma/nodered-contrib-signal-client/blob/838256237ad0699b158219d3fed27bf88af99599/src/signal-client.js#L153

But I would like show this: https://github.com/signalapp/Signal-Server/blob/3432529f9c018d75774ce89f3207b18051c26fe7/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java#L190

If this it the original code on serverside, the captcha is expected as QueryParam and not as posted json data, like @bbernhard did in here: https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/HOMEASSISTANT.md Perhaps, the api accept both ways, but the "official" might be better, I think.

@Onixarts: (according to @FredBlo ) The node uses the "registerSingleDevice" method, which definetly kicks out a previous device. I did some cross test on an iOS client and got authentication failures there after node-red activation. Your search for a linkDevice, like https://github.com/AsamK/signal-cli/ offers.

bbernhard commented 3 years ago

If this it the original code on serverside, the captcha is expected as QueryParam and not as posted json data, like @bbernhard did in here: https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/HOMEASSISTANT.md Perhaps, the api accept both ways, but the "official" might be better, I think.

Just for clarification: The signal-cli-rest-api is just a small wrapper around signal-cli. So, I am not directly communicating with the Signal servers.

gausma commented 3 years ago

I've added the captcha functionality and updated the nodered-contrib-signal-client to version 2.4.0. Also the library @gausma/libsignal-service-javascript was updated. Please update both and verify the new functionality. I hope everything works. Thanks to all who helped fixing the issue.

BlackCatPeanut commented 3 years ago

I've updated and working great for me. The documentation is excellent - great job!

baldfox commented 3 years ago

So I just started a fresh install of node-red in docker, and installed the palette but when I go to the captcha page (im getting 402 error), I'm seeing this (under developer tools) - image

Where it says token, is this where I should be seeing the key? I also can see a sha key at the top of the page and also a sitekey, but nothing that matches what you mentioned in the description? @gausma

I swear am jinxed :)

gausma commented 3 years ago

I've prepared 2 chrome screenshots. I hope this helps ... grafik grafik

baldfox commented 3 years ago

@gausma Thank you for that. This was what I was looking at before. For some reason maybe my IP had been flagged as abusive due to the number of tries previously. I repeated the steps and it did indeed throw me out the token. Once i popped that in, everything worked and I was able to receive the code and register. I was able to send straight away, but I could only receive once I removed an extra receive node i had lying on the flow. Thanks to everyone for their help!

yegads commented 3 years ago

I've been having trouble trying to get the Signal client working on my Pi4; mainly because I can't seem to get past the registration process, even though I've followed the instructions above and managed to enter the capture code. When I send the capture code I get the following response (mobile number redacted): "Signal client error: {"successfulIdentifiers":[],"failoverIdentifiers":[],"errors":[{"name":"OutgoingMessageError","identifier":"+XXXXXXXX","code":401,"reason":"Failed to retrieve new device keys for number +XXXXXXXX"}],"unidentifiedDeliveries":[],"dataMessage":{"type":"Buffer","data":[56,190,192,158,179,131,47]}}" I'd appreciate people's comments on what might be the problem.

Furthermore, from reading some of the comments above, I have some concerns and would appreciate your comments on the following:

  1. Am I correct in assuming that if I register a signal account via the nodered flow using my smartphone number, then my smartphone messaging App will be disconnected. This would defeat my purpose as I want the smartphone to be the recipient opf the nodered initiated alerts.
  2. Therefore, is it possible to register/bind multiple account names (instances) to the same smartphone
  3. Once I manage to get past the registration step, can I then I presume that I can use multiple signal "send" nodes from different flows, correct?
gausma commented 3 years ago

The Signal app on a smart phone is bound to a phone number. To use the Node-RED signal nodes, a phone number must be registered for a so-called account, which is used to authenticate the sender and receiver nodes. A phone number can be used either for a mobile phone or for a node account. Multiple devices or accounts cannot be used with one phone number.

But there's no reason to give Signal your mobile phone number. By providing Signal with any phone number at which you can receive an SMS or voice message, you can register a Signal account at that other phone number.

For example keep your cell phone number and Signal account on your cell phone as it is. Use your land line number or some other number for your Node-RED system.

If you've managed the registration you can use multiple sender nodes with one account but only one reveiver node.

yegads commented 3 years ago

Hi,

No worries. I actually gave up on Signal as I found it too difficult to navigate this registration process on NodeRed.

I can strongly recommend Telegram, which is reliable, stable and easy to set up.

Good luck.

On 27 Jun 2021, at 8:25 pm, BlackCatPeanut @.***> wrote:

Sorry to comment on a closed issue but it seems the most relevant to my issue. I'm in the inspector trying to grab the token for registration. I complete the captcha - however get an empty token in the inspector:

https://user-images.githubusercontent.com/17835997/123555393-64fb3280-d77d-11eb-8b07-32d9d7b31a28.png Any suggestions or ideas? I've tried a difference browser and incognito mode...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gausma/nodered-contrib-signal-client/issues/18#issuecomment-869206074, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATHXPVIVRZ53GGSEYOCIBG3TU5UKZANCNFSM4XJG6H2A.

dewgenenny commented 2 years ago

Captcha code, found on the Home Assistant github

https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/HOMEASSISTANT.md

When you try to register a number, if you receive a response like {"error":"Captcha required for verification (null)\n"} then Signal is requiring a captcha. To register the number you must do the following (in Mozilla Firefox):

Go to https://signalcaptchas.org/registration/generate.html Open the developer console Answer the captcha On the developer console, find the line that looks like this: Prevented navigation to “signalcaptcha://{captcha value}” due to an unknown protocol. Copy the captcha value

After received sms code I've put it into register node. But it looks like registering my phone number in node-red cause my desktop and android phone clients unregisters. I can't make this work.

The above instructions worked for me to register a previously unused telephone number with signal