Skip to content

Authentification API

Liam Boudadi edited this page Feb 6, 2025 · 13 revisions

Listing existing formations, quizzes and videos

POST /change-password (update the user's password associated with the JWT)

Parameters

None

Responses

http code content-type response
200 string Password changed successfully
400 string New password does not meet security requirements
401 string Current password is incorrect
404 string User not found

Example cURL

 curl -L -X POST 'http://localhost:8080/authenticate/change-password' -H 'Authorization: Bearer {JWT}' --data-raw "{"currentPassword": {string}, "newPassword": {string}}"
POST /reset-password?{email} (reset the requested user password)

Parameters

name type data type description
email required int The specific user email

Responses

http code content-type response
200 string Password reset successfully
404 string User not found
500 string Error sending email

Example cURL

 curl -L -X POST 'http://localhost:8080/authenticate/reset-password?{email}' -H 'Authorization: Bearer {JWT}' 
GET /need-change-password (return true if the user associated with the JWT needs to change his password, false otherwise)

Parameters

None

Responses

http code content-type response
200 string True or False
404 string User not found

Example cURL

 curl -L -X GET 'http://localhost:8080/authenticate/need-change-password' -H 'Authorization: Bearer {JWT}'
POST /delete-user?{email} (delete the request user)

Allowed role

ADMIN

Parameters

name type data type description
email required string The specific user email

Responses

http code content-type response
200 string User deleted successfully
404 string User not found

Example cURL

 curl -L -X POST 'http://localhost:8080/authenticate/delete-user?{email}' -H 'Authorization: Bearer {JWT}'
GET /export-users (export users in csv file)

Allowed role

ADMIN

Parameters

None

Responses

http code content-type response
200 csv Users' info
500 string Error exporting users: {error message}

Example cURL

 curl -L -X GET 'http://localhost:8080/authenticate/export-users' -H 'Authorization: Bearer {JWT}'
POST /register (register a new user)

Allowed role

ADMIN

Parameters

None

Responses

http code content-type response
200 string User registered successfully
409 string User already exists
500 string Error sending email

Example cURL

 curl -L -X POST 'http://localhost:8080/authenticate/register' -H 'Authorization: Bearer {JWT}' --body-raw "{'firstName': {string}, 'lastName': {string}, 'email': {string}, 'position': {string}, 'role': {ADMIN or USER}}"
GET /get-user (return the user's infos associated with the JWT)

Parameters

None

Responses

http code content-type response
200 json {"id": {int}, "firstName": {string}, "lastName": {string}, "email": {string}, "position": {string}, "role": {ADMIN or USER}}
404 string User not found

Example cURL

 curl -L -X GET 'http://localhost:8080/authenticate/get-user' -H 'Authorization: Bearer {JWT}'
GET /{formationId} (gets details about the formation requested)

Parameters

name type data type description
formationId required int The specific formation id

Responses

http code content-type response
200 json {"id": {int}, "name": {string}, "description": {string}}
404 N/A

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/{formationId}' -H 'Authorization: Bearer {jwt}'

Clone this wiki locally