-
Notifications
You must be signed in to change notification settings - Fork 9
Accessing APIs without React
Cris Simpson edited this page Apr 14, 2021
·
4 revisions
As of c863c77 , a valid JWT is needed to access API endpoints. If you don't want to use the normal route (React) there are a few options:
- Programmatically through JS: See examples in Login.js, Admin.js, Search.js
- Programmatically through Python: See /server/test_api.py
- Using Postman
To use Postman:
- Get a valid JWT, which is returned by /api/user/login
- You can do this through Postman or by capturing the returned
access_token
value using browser devtools
- You can do this through Postman or by capturing the returned
- Tell Postman to use that value for API calls
- Copy the value
- Edit the collection (three dots when hovering to right of collection name, Edit)
- Choose Authorization, Type: Bearer Token
- Paste value into the Token field, save
Start issuing API calls
401 - Bad login credentials
403 - Tried to access an Admin endpoint with user-level credentials
422 - JWT value was corrupted/failed validation