如何验证Codeigniter用户,无需登录表单? [英] How to authenticate Codeigniter user, without login form?

查看:99
本文介绍了如何验证Codeigniter用户,无需登录表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证Codeigniter用户,而不使用登录表单?

How can I authenticate Codeigniter user, without using login form?

如果他有某个特定值的cookie或者从某个特定链接重定向到

Ie, if he have cookie with some specific value or he is redirected from some specific link, to be authenticated automatically?

推荐答案

假设两个应用程序都在CodeIgniter上 - 您必须同意您的应用程序和第三方之间的一些参数

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.

进入 config / config.php 并设置双方最少):

Head into config/config.php and have both parties set (at the least):

$ config ['sess_cookie_name'] $ config ['cookie_prefix '] 为相同的值。

如果您决定加密会话,您还必须同意第三方和您的应用程序,并适当设置 $ config ['encryption_key'] 值。

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.

最后, ,您必须设置cookie域, $ config ['cookie_domain'] 或CodeIgniter将拒绝它。

Lastly, and perhaps most importantly, you must set the cookie domain, $config['cookie_domain'] or CodeIgniter will reject it.

然后,您可以使用 $ this-> session-> userdata() $ this-> session-> set_userdata()

,所以我不能真正保证或支持可能出现的任何问题,但希望它设置你在一些成功的路径。

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.

这篇关于如何验证Codeigniter用户,无需登录表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆