July 2018
Intermediate to advanced
324 pages
8h 14m
English
Before accessing the resource APIs, we need to authenticate the user and get a JWT access token. Let's get an access token using the api-token-auth API. We are going to use the curl command-line tool to executes the API. The following is the curl command execution:
$ curl -H "Content-Type: application/json" -X POST -d '{"username":"abdulwahid", "password":"abdul123#"}' http://localhost:8000/api-token-auth/{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFiZHVsd2FoaWQiLCJleHAiOjE1Mjk1NjYxOTgsImVtYWlsIjoiYWJkdWx3YWhpZDI0QGdtYWlsLmNvbSJ9.QypghhspJrNsp-v_XxlZeQFi_Wsujqh27EjlJtOaY_4"}
Here, we got the JWT token in response to user authentication. Now we are going to use this token as an authorization ...
Read now
Unlock full access