colinskow / superlogin

Powerful authentication for APIs and single page apps using the CouchDB ecosystem which supports a variety of providers.
MIT License
370 stars 116 forks source link

Validation failed #192

Open jay-b opened 6 years ago

jay-b commented 6 years ago

I'm working with this example code from Josh Morony.

I realise this has been mentioned in an earlier issue before the code was updated, but I cannot seem to get this past this error using the latest code. Any ideas?

OPTIONS /auth/register 204 0.153 ms - 0 (node:91488) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: {"status":404,"name":"not_found","message":"missing","reason":"missing"} { error: 'Validation failed', validationErrors: Error: {"status":404,"name":"not_found","message":"missing","reason":"missing"} at /cloudo/server/node_modules/superlogin/lib/user.js:71:15 at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7), status: 400 } POST /auth/register 400 6.461 ms - 64

Response {_body: "{"error":"Validation failed","validationErrors":{},"status":400}", status: 400, ok: false, statusText: "Bad Request", headers: Headers, …} headers : Headers _headers : Map(1) {"content-type" => Array(1)} _normalizedNames : Map(1) {"content-type" => "content-type"} __proto__ : Object ok : false status : 400 statusText : "Bad Request" type : 2 url : "http://localhost:3000/auth/register" _body : "{"error":"Validation failed","validationErrors":{},"status":400}" __proto__ : Body

Node : v9.2.0 npm : 5.5.1

silverbackvasco commented 6 years ago

I've been looking for the past couple days as well for a solution to this. I have the exact same issue from tutorial. No idea how to solve this one but I'll carry on searching for a solution and post something here if I find it.

silverbackvasco commented 6 years ago

Ok. So for me the issue seemed to be a couple of things. I was using couch db 2 and saw in console it was causing a lot of errors for some reason. Looks like it's because im using a mac. I downgraded to couch 1.6 and the server started giving me the TypeError: The "digest" argument is required and must not be undefined at pbkdf2 (crypto.js:635:11) error which I fixed replacing the pwd file: https://github.com/colinskow/superlogin-demo/issues/12.

jay-b commented 6 years ago

Thanks for the update. Interesting that you can get this working using Couch 1.6. I'm using a Mac and Couch 2.1.1 as well but I get no such console errors. I've tried connecting to Cloudant and get the same validation error. Also tried the quick start example using Postman, same problems.

silverbackvasco commented 6 years ago

I worked backwards with the superlogin quickstart by using the postman tool like you did. I don't think I made it clear my error wasn't in the app console it was the couch db console log.

screen shot 2017-11-30 at 19 58 56

Did you try replacing the couch-pwd file?

ZmartifyPKR commented 6 years ago

Any one who solved the issue mentioned in the first post?

silverbackvasco commented 6 years ago

Sorry if I wasn't clear about how I solved the issue. I replaced the index.js file in couch-pwd folder in node modules for the server. I just copied and pasted the whole contents to index.js file from here: https://github.com/zemirco/couch-pwd/blob/master/index.js

silverbackdan commented 6 years ago

A more stable way to resolve this is to update your package.json file couch-pwd dependency: "couch-pwd": "github:zeMirco/couch-pwd"

Or use the current superlogin master branch.

This issue can be closed. Discussions are ongoing about continued support and a new release version for SL https://github.com/colinskow/superlogin/issues/197

There is also another proposed solution here: https://github.com/colinskow/superlogin/pull/191

silverbackdan commented 6 years ago

Original issue: https://github.com/colinskow/superlogin/issues/64