/authentication
POST
/authentication
Body Parameters
- bodyobjectrequired
- strategystringExampleDescription
- emailstringExampleDescription
- passwordstringExampleDescription
Responses
201
- object
- accessTokenstringExample
- userobject
- _idstringExample
- emailstringExample
401
- object
- namestringExampleDescription
- messagestringExampleDescription
- codenumberExampleDescription
- classNamestringExampleDescription
- errorsobjectDescription
curl
curl --request POST \
--url /authentication \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("/authentication", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("/authentication")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "/authentication"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// successful operation
{
"accessToken": "VeryLongToken",
"user": {
"_id": "myUserId",
"email": "[email protected]"
}
}401
// Unauthorized
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"errors": {}
}Creates a JWT token for a user session which should be used to authenticate other requests as a bearer token. The token is valid for 24 h.