How can I authenticate Codeigniter user, without using login form?
Ie, if he have cookie with some specific value or he is redirected from some specific link, to be authenticated automatically?
How can I authenticate Codeigniter user, without using login form?
Ie, if he have cookie with some specific value or he is redirected from some specific link, to be authenticated automatically?
Assuming both applications are on CodeIgniter - You must agree upon some parameters between your application and the third-party that will be issuing the cookie.
Head into config/config.php
and have both parties set (at the least):
$config['sess_cookie_name']
and $config['cookie_prefix']
to be the same values.
If you decide to encrypt your session, you must also agree upon an encryption key between the third party and your application and set the $config['encryption_key']
value appropriately.
Lastly, and perhaps most importantly, you must set the cookie domain, $config['cookie_domain']
or CodeIgniter will reject it.
You can then get and set session cookies using $this->session->userdata()
and $this->session->set_userdata()
, respectively.
I've never tried this before, so I can't really vouch or support to great length any issues that may arise, but hopefully it sets you on the some path to success.