1

有人可以帮我完成这项工作吗?

问题是它只是将查询字符串附加到 url 上,仅此而已。没有谷歌登录页面!

http://domain.nl/controller/function?action=verify&openid_identifier=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid

也许这是特定的事情,例如我使用 mvc 设计和 htaccess 文件。

我现在还不清楚解决方案。

请指出我正确的方向

谢谢,理查德

在控制器中......这是表单指向的功能

public function openid(){

        try {
    $openid = new LightOpenID;
    if(!$openid->mode) {
        if(isset($_GET['action'])) {
            $openid->identity = 'https://www.google.com/accounts/o8/id';
              //$openid->identity = 'https://www.google.com/accounts/o8/site-xrds?hd=YourDomain.in'; //this can be changed as you know...  
            header('Location: ' . $openid->authUrl());
        }
/*<form action="?login" method="post">
    <button>Login with Google</button>
</form>*/

    } elseif($openid->mode == 'cancel') {
        echo 'Gebruiker heeft authenticatie geannuleerd!';
    } else {
        echo 'Gebruiker ' . ($openid->validate() ? $openid->identity . ' heeft ' : 'heeft niet ') . 'ingelogd.';
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
}

    }
4

1 回答 1

1

看起来重定向不起作用。检查是否$openid->authUrl()返回正确的值。如果是这样,那么问题与 LightOpenID 无关。

此外,如果您计划将 site-xrds 与 google 身份验证一起使用,请确保在返回的文档中包含以下标头http://your.domain/openid

header('X-XRDS-Location: https://www.google.com/accounts/o8/site-xrds?hd=your.domain');

否则,验证将失败。

于 2011-04-02T10:30:33.823 回答