API Authentication

Generate a JSON web token which will be used in all further api requests

export RECORDER_HOST=https://recorder.myapp.com
curl -H "Content-Type: application/x-www-form-urlencoded" -d"username=user@example.com&password=hello"  -XPOST "$RECORDER_HOST/generate-jwt-token"

# Returns a JSON reponse
# {"token":"eyJKbUd..."}

Note that the user has to have admin rights to access the api(The first user who signs up is automatically promoted to an Admin) The expiry of the token is set to 60 minutes by default and can be configured through

# ~/.sessionrecord/config
# Restart is required
export API_JWT_MAXAGE=30m

You will recieve a 401 status code after token expiry and you will have to refresh the token using the same auth api

All API requests have to be authorized using the JWT as shown below

curl -H"Authorization: JWT <token_here>"  $RECORDER_HOST/api/v1/...

results matching ""

    No results matching ""