Comment on page
Login with Username and Password
HTTP Method | URL | Requires Auth |
---|---|---|
POST | /api/v1/login | no |
Key | Example Value | Description |
---|---|---|
user | [email protected] OR myusername | Your username or email. |
password | my$up3erP@ssw0rd | Your password. |
resume | 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq | Yor previously issued authToken . |
- Whilst none of the arguments are required in every request, every request requires some arguments to be provided. You MUST provide either
user
ANDpassword
, or provideresume
. - You will need to provide the
authToken
anduserId
for any of the authenticated methods. - If LDAP authentication is enabled, you must maintain the login in the same way as you normally do. Similarly, if 2FA is enabled for an LDAP user, everything stays the same.
With username and password:
curl http://localhost:3000/api/v1/login \
-d "user=myusername&password=mypassword"
With email and password:
curl http://localhost:3000/api/v1/login \
-d "[email protected]&password=mypassword"
With username and password:
curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "user": "myusername", "password": "mypassword" }'
With email and password:
curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "user": "[email protected]", "password": "mypassword" }'
With user, password, and code:
curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "user": "myusername", "password": "mypassword", "code": "224610" }'
With email, password, and code:
curl -H "Content-type:application/json" \
http://localhost:3000/api/v1/login \
-d '{ "user": "[email protected]", "password": "mypassword", "code": "224610" }'
{
"status": "success",
"data": {
"authToken": "9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq",
"userId": "aobEdbYhXfu5hkeqG",
"me": {
"_id": "aYjNnig8BEAWeQzMh",
"name": "Rocket Cat",
"emails": [
{
"address": "[email protected]",
"verified": false
}
],
"status": "offline",
"statusConnection": "offline",
"username": "rocket.cat",
"utcOffset": -3,
"active": true,
"roles": [
"admin"
],
"settings": {
"preferences": {}
},
"avatarUrl": "http://localhost:3000/avatar/test"
}
}
}
Version | Description |
---|---|
1.0.0 | Added avatarUrl property to response |
0.64.0 | Added me property to response |
0.60.0 | Added |
Last modified 5d ago