Auth API
This documentation describes the API endpoints for user authentication and authorization in our fest management framework.
Base URL
/api/auth
Endpoints
POST
/login
POST
/loginAuthenticate a user with email and password.
Request
Response
Toggle Response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA8c2FsdHJvdW5kcyFuZGhhZGhhcHBlcnMiLCJyb2xlIjoidXNlciIsImlhdCI6MTYzNDkyOTk4MSwiZXhwIjoxNjcwOTIyOTgxLCJvcmdhbmlzYXRpb24iOiI1ZjdmMmI5YTRmM2QxZTBiMWM5YjRjN2EiLCJyb2xlIjoiVXNlciBDaGV0dHJpIn0.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA4YzA5ODRmMyIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNjM0OTI5OTgxLCJleHAiOjE2NzA5MjI5ODF9.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"user": {
"_id": "5349b4ddd2781d08c09890f3",
"name": "Dhan Bahadur Chhettri",
"email": "user@example.com",
"role": "user",
"organisation": "5f7f2b9a4f3d1e0b1c9b4c7a"
}
}
POST
/register
POST
/registerRegister a new user.
Request
Toggle Request Body
{
"name": "Dhan Bahadur Chhettri",
"email": "user@example.com",
"password": "user_password",
"role": "user",
"organisation": "5f7f2b9a4f3d1e0b1c9b4c7a"
}
Response
Toggle Response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA8c2FsdHJvdW5kcyFuZGhhZGhhcHBlcnMiLCJyb2xlIjoidXNlciIsImlhdCI6MTYzNDkyOTk4MSwiZXhwIjoxNjcwOTIyOTgxLCJvcmdhbmlzYXRpb24iOiI1ZjdmMmI5YTRmM2QxZTBiMWM5YjRjN2EiLCJyb2xlIjoiVXNlciBDaGV0dHJpIn0.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA4YzA5ODRmMyIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNjM0OTI5OTgxLCJleHAiOjE2NzA5MjI5ODF9.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"user": {
"_id": "5349b4ddd2781d08c09890f3",
"name": "Dhan Bahadur Chhettri",
"email": "user@example.com",
"role": "user",
"organisation": "5f7f2b9a4f3d1e0b1c9b4c7a"
}
}
GET
/refresh
GET
/refreshRefresh an access token using a refresh token.
Request
Toggle Request Body
{
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA4YzA5ODRmMyIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNjM0OTI5OTgxLCJleHAiOjE2NzA5MjI5ODF9.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk"
}
Response
Toggle Response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA8c2FsdHJvdW5kcyFuZGhhZGhhcHBlcnMiLCJyb2xlIjoidXNlciIsImlhdCI6MTYzNDkyOTk4MSwiZXhwIjoxNjcwOTIyOTgxLCJvcmdhbmlzYXRpb24iOiI1ZjdmMmI5YTRmM2QxZTBiMWM5YjRjN2EiLCJyb2xlIjoiVXNlciBDaGV0dHJpIn0.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MzQ5YjRkZGQyNzgxZDA4YzA5ODRmMyIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNjM0OTI5OTgxLCJleHAiOjE2NzA5MjI5ODF9.WYsdP4_U8SVsC9vV9vyG_BrG3A3gD9GkN0m1i6S7auk",
"user": {
"_id": "5349b4ddd2781d08c09890f3",
"name": "Dhan Bahadur Chhettri",
"email": "user@example.com",
"role": "user",
"organisation": "5f7f2b9a4f3d1e0b1c9b4c7a"
}
}
GET
/logout
GET
/logoutLogout a user (requires authentication).
Response
Last updated