In order to make efficient usage of the trusted user and the password of PostgREST, we will combine these two values into a token so that any API requests carrying that token will be accepted by PostgREST as the correct password and correct trusted user:
Figure 6.9 – Creating a token
We'll get started with creating the token using the following steps:
- We will first open https://jwt.io on the browser and fill in the required details as shown:
- Password: DFZ49GQGubpzcSbt3t2uMIiBF6pU4PJ8
- JSON: "role": "atm_user"
- Copy the result token:Â eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYXRtX3VzZXIifQ.ZL8hsLj5cewZvgb81EXm5vC3Jpn_4TzpszwMBStu-xo
You can see the preceding values are entered in Figure 6.9.
- We will now write the following command to be able to use the encoded token to add a new ATM location, on the other terminal (not the one that PostgREST is running inside):
[centos@ip-172-31-95-213 ~]$ export...