相关疑难解决方法(0)

使用LightOpenID登录用户

您好
我几个小时前已经下载了LightOpenID(http://gitorious.org/lightopenid),但仍然无法弄清楚如何使它工作.
我把这个google示例保存在test.php文件中

<?php
require '../lib/init.php';
require '../lib/openID/openid.php';

try {
    if(!isset($_GET['openid_mode'])) {
        if(isset($_GET['login'])) {
            $openid = new LightOpenID;
            $openid->identity = 'https://www.google.com/accounts/o8/id';
            header('Location: ' . $openid->authUrl());
        }
?>
<form action="?login" method="post">
    <button>Login with Google</button>
</form>
<?php
    } elseif($_GET['openid_mode'] == 'cancel') {
        echo 'User has canceled authentication!';
    } else {
        $openid = new LightOpenID;
        echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
} …
Run Code Online (Sandbox Code Playgroud)

php openid lightopenid

10
推荐指数
3
解决办法
1万
查看次数

用PHP实现OpenID

我对实现OpenID感兴趣并且我一直在阅读它,但仍然有一些方面我有点困惑.

我已经看到了交互和逐步详细信息的多个流程图,例如这个,但它们都跳过了有关成功登录后会发生什么的详细信息.我读过的所有内容都说"成功登录后,用户会被重定向回网站".那么,我的网站如何知道登录成功了?是否设置了Cookie,我还会收到回复邮件吗?

例如,以下是我所包含的链接的详细信息

9. User POSTs response to OpenID Server.
10. User is redirected to either the success URL or the failure URL returned in (5) depending on the User response

//this is the step that it says tells me I've had a succes/failure upon login
5. Consumer inspects the HTML document header for <link/> tags with the attribute rel set to openid.server and, optionally, openid.delegate. The Consumer uses the values in these tags to construct a URL …
Run Code Online (Sandbox Code Playgroud)

php openid

7
推荐指数
1
解决办法
2265
查看次数

标签 统计

openid ×2

php ×2

lightopenid ×1