I've been thinking lately about how all of the authentication methods used in API to API communications (RESTful API's) are mostly methods that have been designed to be human oriented first (tokens\passwords\etc) & how in API this often means you need a secret store to have the passwords\tokens stored in it.

My idea is that the requester API will contact the receiver API with a hashed token & a callback webhook address, the callback URL effectively acting as the user identity which the receiver API then contacts (in a new connection) which he then get the unhashed token from, the receiver token then compares the hashed and unhashed version of the token and should they match he knows that the requester of the original request is in fact the API of the webhook.

A workflow of the auth process is described in full in the following diagram: auth workflow process

I've also created a docker-compose POC of the concept at my github which works as i thought it will (please note that while I will gladly receive notes about the POC this question is only about the theory of the concept as a whole being secure).

The question

Is this really secure? Is there any vulnerability I missed to this authentication method which will allow an attacker to trick the receiver API by impersonating another API?

If there isn't is there any way to prove without a doubt (mathematically or otherwise) that this is in fact secure?

Assume the following are given:

  • HTTPS is used (to protect against MITM) on all requests
  • The backend DB is secure
  • Tokens are generated randomly & are not reused
  • The hashing function is modern enough to provide good protection
  • The DNS register of both API's is secure
  • This is an authentication only method, not authorization nor encryption.

closed as off-topic by GlenH7 Mar 31 at 18:03

  • This question does not appear to be about software engineering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.