CodeIgniter Forums
REST_Controller - Generating the API-KEYs? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7)
+--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13)
+--- Thread: REST_Controller - Generating the API-KEYs? (/showthread.php?tid=70960)



REST_Controller - Generating the API-KEYs? - regjel - 06-22-2018

Hi All,

I've installed the REST library by chriskacerguis and turned on API-KEY authentication. I'm building an API to be consumed by web and mobile apps (my own).

Can anyone describe the actual steps needed to generate and save those API-KEYs into the 'keys' database table? Should I have a separate API controller (not REST_Controller) that deals with signup and creates/inserts that?

Or should I use an OAuth2 library to authenticate the clients and return/save the keys?

Just need some clarification on exactly how the flow works. Thanks.


RE: REST_Controller - Generating the API-KEYs? - Pertti - 06-22-2018

https://github.com/chriskacerguis/codeigniter-restserver#api-keys

The short documentation doesn't say anything about how to generate them, so it looks like you just put a random string in the table yourself, with relevant details like generation time, and off you go.


RE: REST_Controller - Generating the API-KEYs? - enlivenapp - 07-02-2018

Don't do a random string manually.

Sadly, Chris has taken the Phil Sturgeon School of Documentation masters course.

Check out the below file on how to generate keys.
https://github.com/chriskacerguis/codeigniter-restserver/blob/master/application/controllers/api/Key.php


RE: REST_Controller - Generating the API-KEYs? - regjel - 07-02-2018

(07-02-2018, 10:37 AM)enlivenapp Wrote: Don't do a random string manually.

Sadly, Chris has taken the Phil Sturgeon School of Documentation masters course.

Check out the below file on how to generate keys.
https://github.com/chriskacerguis/codeigniter-restserver/blob/master/application/controllers/api/Key.php


Thanks enlivenapp!! Smile