我的php网站的gmail身份验证

时间:2012-03-06 11:19:09

标签: php authentication openid gmail single-sign-on

我有一个php网站,我想首先通过gmail对用户进行身份验证,然后让他使用我的网站内容(比如http://stackoverflow.com使用的想法)

以下是我想要实现的简单想法

如果用户输入www.example.com并且他已经登录gmail帐户,那么他将被定向到www.example.com/services.php

如果用户没有登录,那么他将被定向到gmail登录页面。

我需要一个工作示例,我使用术语openid,sso,联合登录等进行了大量搜索,但我找不到任何有用的示例

3 个答案:

答案 0 :(得分:7)

Google的Federated Login for Google Account Users文章解释了所有内容(此处为general explanation)。不幸的是,我不希望这里有人为你编写代码。

答案 1 :(得分:3)

答案 2 :(得分:2)

通过GMail,我认为您的意思是Google帐户?

这不是一个快速而简单的过程,因为Google非常重视隐私。 But here's a full documentation on how to authenticate with Google.