Sign in to the API. Writes access token to the cookie client.
POST /api/auth/signin
| Name | Type | Description |
|---|---|---|
username |
string |
The email address of the user. |
password |
string |
The password of the user. |
200 OK
401 Unauthorized
curl -i
-X POST
-H "Content-Type: application/json"
-d '{"username": "VoDA", "password": "password"}'
http://localhost:3000/api/auth/signin
Sign out of the API.
POST /api/auth/signout
200 OK
401 Unauthorized
curl -i
-X POST
-H "Content-Type: application/json"
http://localhost:3000/api/auth/signout
Refresh the access token.
POST /api/auth/refresh
200 OK
401 Unauthorized
curl -i
-X POST
-H "Content-Type: application/json"
http://localhost:3000/api/auth/refresh
When you create a private API, you should use the authGuard to protect it.
import express from 'express';
import { authGuard } from '../guards/AuthGuard';
const router = express.Router();
router.get('/your/api/path', authGuard, (req, res) => {
// your API logic
});
module.exports = router;