(I use PHP) I want to able users edit their profile via my RESTful api. Each user has unique id (something of public key, right?), and secret api key stored in the DB and no-one has access to this key ('even' no to the user himself. sub-question:
can I display the user his secret key? I noticed that Facebook does it and even use it at their php-sdk).
So I read this answer - https://stackoverflow.com/a/8567909/410065, and decided that the way I want to implement (don't think there are another ways (?)).
As I understood, I need to make this call to update: PUT http://api.domain.com/user/4/?sig=..result of hash_hmac..
, but my problem is that - how can I know the result of hash_hmac
(to register the sig
field) BEFORE i call it? Of course I should make two calls to hash_hmac
- first to make the sig
to sending the html form, and second to validate the user. but where I make the first call of the function? (It should be between the form submit and the RESTful call).