-
Notifications
You must be signed in to change notification settings - Fork 2k
RESTful API Usage and Security #1656
Comments
Update: I trited to add the header about Content-Length and got the following error:
And another problem, it hanged up indeed! |
Update 2: I found a similar problem in the Stack Overflow. It proposed the reason why. Because of the body-parser. But I found meanjs already uses bodyParser in config/lib/express.js. As a result, I am confused. Actually, when I printed the message of req.body, it shows empty: {}. |
Thanks by God, I found the solution of the first problem:
The key point is the lastest version has changed the "username" to "usernameOrEmail". |
I thought we already had support for username and email. I guess I'm confused where this got changed (or if I was dreaming things). |
It was a fairly recent change: 6a6b630 If you modify line 13 of I think this also involves questions of whether the username field should be ditched altogether in favour of email addresses to identify users, which I think I saw mentioned somewhere. |
For my own apps, I use email for logins. However, I don't necessarily see the need to enforce that here.
I think we should do this. Even though we're checking both username & email in the logic, by having a consistent name of "username" that the API & client-side forms use, we would be hiding a bit of the logic from parties that need not know how we're actually performing logins. |
@mleanos agree. |
@lirantal this can be closed? Seems to be resolved. |
One year ago, I tried to use the signin restful api of meanjs, localhost:3000/api/auth/signin, using the following command:
and then, in signin.json:
However, when I retried the same command at present, I got the following issue about HTTP Status 411:
It seems that I should include the Content-Length in the request? How can I fix it?
Another question is, the password in request is plaintext, how can I encode it and decode it in the server-side? Add a decoder in the controller of the server-side?
The text was updated successfully, but these errors were encountered: