There are two parts to authenticating REST API calls. When a user logs in with your service, you usually assign a KEY that identifies that user. Sometimes this is enough. But this KEY can be split or stolen. In this case, your service will continue to be considered KEY valid. Now, to prevent key hijras, etc., you will also distribute the secret key. This key is never transported with a REST API request. This key is used to execute a one-way hash of the API request and create a signature (HMAC).
This signature, plus an API request (an HTTP request as a URL), is then sent to the API server. The server performs a one-way hash of the URL and compares with the signature using this user's private key. If they match, it is “assumed” that the requestor has access to the private key, and therefore the request is valid.
In order to avoid repeated attacks, in addition to nonce (as suggested by the previous poster), you can also use a hash chain.
Kingz source share