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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.phpand 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.