Log in and register password accounts over HTTP
meteor add simple:rest-accounts-password
If you have accounts-password
in your app, and you want to be able to use it over HTTP, this is the package for you. Call these APIs to get an access token, and pass that token to API methods you defined with simple:rest
to call methods and publications that require login.
Make sure to serve your app over HTTPS if you are using this for login, otherwise people can hijack your passwords. Try the force-ssl
package.
POST /users/login, POST /users/register
The login and registration endpoints take the same inputs. Pass an object with the following properties:
username
email
password
password
is required, and you must have at least one of username
or email
.
Responses
Both login and registration have the same response format.
1// successful response, with HTTP code 200 2{ 3 token: "string", 4 tokenExpires: "ISO encoded date string", 5 id: "user id" 6} 7 8// error response, with HTTP code 500 9{ 10 error: "error-code", 11 reason: "Human readable error string" 12}
Change log
1.0.3
- Fixed bug where logging into accounts with no email would log into the wrong
account.