User login
curl -X POST "http://localhost:3000/api/auth/login" \
-H "Content-Type: application/json" \
-d '{
"username": "string",
"password": "string"
}'const body = JSON.stringify({
"username": "string",
"password": "string"
})
fetch("http://localhost:3000/api/auth/login", {
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "http://localhost:3000/api/auth/login"
body := strings.NewReader(`{
"username": "string",
"password": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "http://localhost:3000/api/auth/login"
body = {
"username": "string",
"password": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text){
"token": "string",
"user": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"username": "string",
"email": "user@example.com",
"firstName": "string",
"lastName": "string",
"roles": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"permissions": {}
}
],
"isActive": true,
"createdAt": "2019-08-24T14:15:22Z"
}
}{
"error": "string",
"details": "string"
}