PHP rest API authentication

前端 未结 1 2154
忘掉有多难
忘掉有多难 2021-02-06 17:23

I\'m building a restful API for a php application. At the moment, the API will only accept and respond with json. The request, routing and response is all handled by the framewo

相关标签:
1条回答
  • 2021-02-06 17:40

    hash_hmac() expects its second parameter to be a string, you're passing your decoded JSON object instead. Other than that, your approach seems pretty standard. entity_id should also be protected by the HMAC signature, so I'd keep it in the request body or your signature calculation will get a little bit more complicated for no real gain.

    0 讨论(0)
提交回复
热议问题