-
Notifications
You must be signed in to change notification settings - Fork 0
Authentication
We are currently using Devise Auth Token for authentication
POST
request to https://project-run.herokuapp.com/user_token
.
The request will include a JSON with an auth
object that has the email
and password
of the user.
The response will be a JSON again. A sample is provided below:
{
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0ODc3OTcwMDksInN1YiI6MX0.yNXQ5uS2-vx1jIgYD60uNPkZk-qkAndZlBRTocvoAPM"
}
Authenticated resources will have Authenticated resource
in the title
You need to send the JWT token as an Authorization
header as following Bearer jwt_token
.
Example for the JWT from the last response
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0ODc3OTcwMDksInN1YiI6MX0.yNXQ5uS2-vx1jIgYD60uNPkZk-qkAndZlBRTocvoAPM
(more details here https://jwt.io/introduction/)
Example authentication route:
GET
request to https://project-run.herokuapp.com/test
Will return 401
status if Unauthorised
, otherwise 200 with a success status