I authorize all REST API requests by checking token in Authorization header:
POST /rest/resource HTTP/1.1
Host: domain.com
Authorization: Bearer AbCdEf123456
The token is plain text, using HTTPS. However, the token is salted and hashed in the database.
How could I authenticate the request?
- send also user id to the server, select token hash for this user from the database, check if the token is correct (issue with sending user id - where to put it)
- check if some hash in the database corresponds to the token received from the user (performance issue)
There must be some elegant way since for example for google maps the "API key" (token) is sufficient.