Authentication service with jwt tokens.
git clone https://github.com/buraksaraloglu/auth-service.git
cd auth-service
npm install
npm dev
npm run build
npm start
npm test
Create User (Register)
# POST /auth/users
curl --location --request POST '<service-uri>/auth/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "12345678"
}'
Create Session (Login)
# POST /sessions
curl --location --request POST '<service-uri>/sessions' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "12345678"
}'
Get Session (Authorize)
# GET /sessions
curl --location --request GET 'http://localhost:5000/sessions' \
--header 'x-refresh-token: <refreshToken in create session response>' \
--header 'Authorization: Bearer <accessToken in create session response>'
Delete Session (Sign out)
# DELETE /sessions
curl --location --request DELETE 'http://localhost:5000/sessions' \
--header 'x-refresh-token: <refreshToken in create session response>' \
--header 'Authorization: Bearer <accessToken in create session response>'