Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration problem #18

Closed
pawel3410 opened this issue Feb 8, 2021 · 26 comments
Closed

Registration problem #18

pawel3410 opened this issue Feb 8, 2021 · 26 comments

Comments

@pawel3410
Copy link

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
Copy link

baldfox commented Feb 10, 2021

Am also having the same.

@FredBlo
Copy link

FredBlo commented Feb 12, 2021

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
throneless-tech/libsignal-service-javascript#8

@asterix555
Copy link

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

Fixed in signal-cli in November:
AsamK/signal-cli@c3e1d4f

@FredBlo
Copy link

FredBlo commented Feb 13, 2021

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
Copy link

fanuch commented Feb 14, 2021

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
Copy link

fanuch commented Feb 16, 2021

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

@nadeerck2020
Copy link

@fanuch Sorry, i am going to remove it.

@max3232rs
Copy link

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
Copy link

Onixarts commented Mar 4, 2021

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

@fanuch
Copy link

fanuch commented Mar 5, 2021

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
Copy link

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
Copy link
Owner

gausma commented Mar 5, 2021

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
Copy link

Onixarts commented Mar 5, 2021

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
Copy link

Onixarts commented Mar 5, 2021

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
Copy link

FredBlo commented Mar 6, 2021

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
Copy link

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:

sendError(node, `Signal client error: ${JSON.stringify(err)}`);

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
Copy link

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
Copy link
Owner

gausma commented Mar 7, 2021

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
Copy link

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

@baldfox
Copy link

baldfox commented Mar 8, 2021

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
Copy link
Owner

gausma commented Mar 10, 2021

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

@baldfox
Copy link

baldfox commented Mar 11, 2021

@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!

@gausma gausma closed this as completed Mar 11, 2021
@yegads
Copy link

yegads commented Mar 15, 2021

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
Copy link
Owner

gausma commented Mar 15, 2021

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
Copy link

yegads commented Jun 29, 2021 via email

@dewgenenny
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests