PHP 中的 OpenID 自动登录 Janrain 示例
我希望我的网站能够自动检测用户是否登录谷歌。如果是,它会检查数据库以查看它们是否已经注册。如果他们注册了,就会将他们登录到我的网站。否则,它会将他们重定向到登录页面。
我认为这可能是实验性的 x-has-session 但我不知道如何实现它。我正在使用 JanRain OpenID PHP 库。
回复已采纳!
I want my website to automatically detect if a user is logged into google. If they are, it checks the database to see if they are already registered. If they are registered, it logs them in to my site. Otherwise, it redirects them to the login page.
I think it might be the experimental x-has-session but I've no idea how to implement it. I'm using the JanRain OpenID PHP Library.
Responses appriciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚使用 JanRain 和 Zend Framework 编写了这个确切的东西,也使用 Facebook 完成了它。
https://www.google.com/accounts/o8/id
进行通信的脚本。您可能需要考虑当某人使用 Google 登录、然后注销并稍后使用 Google 重新登录时会发生什么。您需要在用户表中检查该用户,并将用户行与 Google 的结果进行匹配,而不是每次都注册一个新用户。
I have just written this exact thing using JanRain and Zend Framework, also done it with Facebook.
https://www.google.com/accounts/o8/id
using JanRain OpenId.You may want to consider what happens when someone logs in using Google, then logs out and then logs back in using Google at a later date. You will need to check for that user in the user table and match the user row up with the result from Google, rather than registering a new user each time.