DEMO
Use cookies or add the
access_token
to theauthorization
header with theBearer
prefix
curl -v -H 'authorization: Bearer <access_token>' \
-X GET 'http://localhost:8080/protected'
Creates a user
curl -v -H 'Content-Type: application/json' \
-d '
{
"email": "admin@admin.com",
"password": "12345678"
}
' -X POST 'http://localhost:8080/auth/sign-up'
Signs a user in
Sets
access_token
andrefresh_token
HttpOnly
cookies
Returns tokens in JSON (if you're not using cookies)
curl -v -H 'Content-Type: application/json' \
-d '
{
"email": "admin@admin.com",
"password": "12345678"
}
' -X POST 'http://localhost:8080/auth/sign-in'
Refreshes an expired access token
If you're using cookies, just make the request without a body
Returns new tokens in JSON (if you're not using cookies)
curl -v -H 'Content-Type: application/json' \
-d '
{
"refresh_token": "token",
}
' -X POST 'http://localhost:8080/auth/refresh'