CodeIgniter Forums

Full Version: How to Create Acces tokens in rest apis codeignietr
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

 I want to create access tokens in codeigniter which will help from hacking or getting access to my webservices from others. Now im using basic authentication for rest apis. can anyone help me in creating access Tokens for rest apis. Thank you
I think this involves having a shared secret key with the user, which is used to encrypt the instructions, so that your api sends the identifier for the user and the encrypted api instructions. This then makes sure the message is from the authenticated user and has not been messed with.

So really you are asking how to encrypt a string with a secret key. You can look here: http://php.net/manual/en/function.hash-hmac.php but to be honest I know next to nothing about security, so searching for an existing php library to do this for you might be advisable.

There seems to be lots of stuff about this online. It is not really a CI issue, but more about what you want to use CI for.

Paul.