8000 400 Bad Request when registering · Issue #2 · swarmcom/jSynapse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

400 Bad Request when registering #2

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

Open
dkokic opened this issue Apr 20, 2015 · 4 comments
Open

400 Bad Request when registering #2

dkokic opened this issue Apr 20, 2015 · 4 comments

Comments

@dkokic
Copy link
dkokic commented Apr 20, 2015

The matrix-angular-sdk web app reports the following error:

/register [1] : {"data":{"flows":[{"type":"m.login.password"},{"type":"m.login.recaptcha"}]},"status":200,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://localhost:5555/_matrix/client/api/v1/register","params":{},"headers":{"Accept":"application/json, text/plain, */*"}},"statusText":"OK"}
matrix-service.js:300 Using flow {"type":"m.login.recaptcha"}
matrix-service.js:225 doRegisterLogin >>> m.login.recaptcha
:5555/_matrix/client/api/v1/register:1 POST http://localhost:5555/_matrix/client/api/v1/register 400 (Bad Request)
angular.min.js:102 SyntaxError: Unexpected token M
    at Object.parse (native)
    at pc (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:14:208)
    at Zb (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:76:379)
    at http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:77:237
    at s (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:7:302)
    at Zc (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:77:219)
    at c (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:78:349)
    at http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:112:20
    at l.$get.l.$eval (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:125:305)
    at l.$get.l.$digest (http://localhost:63342/matrix-angular-sdk/syweb/webclient/lib/angular.min.js:122:398)(anonymous function) @ angular.min.js:102$get @ angular.min.js:76(anonymous function) @ angular.min.js:112$get.l.$eval @ angular.min.js:125$get.l.$digest @ angular.min.js:122$get.l.$apply @ angular.min.js:126l @ angular.min.js:81P @ angular.min.js:85w.onload @ angular.min.js:86
register-controller.js:131 Registration error: {}(anonymous function) @ register-controller.js:131(anonymous function) @ angular.min.js:112$get.l.$eval @ angular.min.js:125$get.l.$digest @ angular.min.js:122$get.l.$apply @ angular.min.js:126l @ angular.min.js:81P @ angular.min.js:85w.onload @ angular.min.js:86
dialog-service.js:97 Unknown error: {}showError @ dialog-service.js:97(anonymous function) @ register-controller.js:151(anonymous function) @ angular.min.js:112$get.l.$eval @ angular.min.js:125$get.l.$digest @ angular.min.js:122$get.l.$apply @ angular.min.js:126l @ angular.min.js:81P @ angular.min.js:85w.onload @ angular.min.js:86
recaptcha_ajax.js:187 Uncaught TypeError: Cannot set property 'innerHTML' of null

On jSynapse console there are no errors

@dkokic dkokic changed the title Internal Server Error when registering 400 Bad Request when registering Apr 20, 2015
@mirceac
Copy link
mirceac commented Apr 21, 2015

You need to send JSON like this:

{
"type": "m.login.recaptcha",
"challenge": "challenge token",
"response": "user-entered text"
}

Here is a client/server example on how to perform recaptcha auth:
https://code.google.com/p/recaptcha/wiki/HowToSetUpRecaptcha

Also, I am currently reviewing the recaptcha authentication implementation and we might need to fix the private key handling server-side. Meanwhile please check password authentication if you can.

Thanks

@dizzy
Copy link
Contributor
dizzy commented Apr 21, 2015

That's correct, what you have to do is to apply for recaptcha key here: https://www.google.com/recaptcha/intro/index.html and to put a file named jsynapse.properties containing a key as recaptcha.private.key=KEY_VALUE, e.g.

recaptcha.private.key=6Ldbaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Sounds a little bit complicated, we plan to expose all these in an admin UI where you could just upload the private key.

@dkokic
Copy link
Author
dkokic commented Apr 21, 2015

Thanks. It works now. i wonder how to make it working locally without recaptcha while developing.

@dizzy
Copy link
Contributor
dizzy commented Apr 21, 2015

You could use the password schema, that is register by posting type of "type": "m.login.password" instead recaptcha, e.g.

{
"type": "m.login.password",
"user": "obo",
"password": "dodo"
}

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

3 participants
0