throneless-tech / libsignal-service-javascript

A javascript library for basic interaction with the Signal messaging service, adapted from Signal-Desktop.
GNU General Public License v3.0
57 stars 21 forks source link

Error when registering SMS number #8

Closed n8fr8 closed 3 years ago

n8fr8 commented 5 years ago

We are getting a "payment required" error message back from the server. Can you verify the lib is stil

{"name":"HTTPError","code":402,"response":"\n\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\nError 402 Payment Required\n\n

HTTP ERROR 402

\n

Problem accessing /v1/accounts/sms/code/+1XXXXXXXXXX. Reason:\n

 Payment Required

\n\n\n","level":"error","timestamp":"2019-10-16T17:18:31.348Z"}

n8fr8 commented 5 years ago

GET https://textsecure-service.whispersystems.org/v1/accounts/sms/code/+1XXXXXXXXXX GET https://textsecure-service.whispersystems.org/v1/accounts/sms/code/+1XXXXXXXXXX 402 Error 2019-10-16T17:18:31.348Z error undefined name=HTTPError code=402 response="

Error 402 Payment Required

HTTP ERROR 402

Problem accessing /v1/accounts/sms/code/+1XXXXXXXXXX. Reason:

    Payment Required

jheretic commented 5 years ago

Hey @n8fr8,

At least at the moment, I was not able to reproduce this error with the library's test client. Using the command: NODE_ENV=production DEBUG=libsignal-service:* STORE=./storage node ./examples/client.js requestSMS +1XXXXXXXXXX password I had the output:

libsignal-service:WebAPI GET https://textsecure-service.whispersystems.org/v1/accounts/sms/code/+1XXXXXXXXXX +0ms
(node:2569125) ExperimentalWarning: The fs.promises API is experimental
  libsignal-service:ProtocolStore ProtocolStore: Finished caching identityKeys data +0ms
  libsignal-service:ProtocolStore ProtocolStore: Finished caching sessions data +0ms
  libsignal-service:ProtocolStore ProtocolStore: Finished caching preKeys data +0ms
  libsignal-service:ProtocolStore ProtocolStore: Finished caching signedPreKeys data +1ms
  libsignal-service:ProtocolStore ProtocolStore: Finished caching configuration data +0ms
  libsignal-service:ProtocolStore ProtocolStore: Finished caching groups data +0ms
  libsignal-service:WebAPI GET https://textsecure-service.whispersystems.org/v1/accounts/sms/code/+1XXXXXXXXXX 200 Success +137ms
Sent verification code.

And received the code at the corresponding phone number (judging from the URL I'm guessing you're trying to get the SMS code as the first step of the registration) and was able to complete registration.

402: Payment Required is not an error defined in the client code, so it must be in the server. Looking at the server code, the only place where I see an HTTP code 402 being sent is https://github.com/signalapp/Signal-Server/blob/109a5b47483d70d2055fab00b54edb6a68fdd7c8/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java#L156

Judging from that, it looks like you're probably being identified as an abusive host and need to fill out a captcha. I'm not 100% sure that's tied to the phone number or to your IP address. If IP, then you could try accessing https://signalcaptchas.org/registration/generate.html in the browser from the same originating IP as you're experiencing the error. If phone number, you could try registering via an official client using that phone number, and seeing if that allows you to complete the captcha.

I hope that helps! Let me know if there's anything more I can do to assist.