【发布时间】:2012-08-14 01:29:04
【问题描述】:
我目前正在尝试为大学的小型网站实施 openID。我对此很陌生,并跟进了相关文章。我已经下载了 lightopenId 并将文件夹上传到我的网络服务器。我的学校有谷歌托管他们的电子邮件服务,所以典型的电子邮件地址是:像这样studentlastname@myuniversity.edu。我们可以通过mail.google.com或者google专门为我们的登录mail.google.com/a/oakland.edu/设计的自定义网页登录。
我可以将用户定向到自定义大学 google 托管页面进行身份验证,而不是将用户重定向到一般 $openid->identity = 'https://www.google.com/accounts/o8/id';?
给我错误:
在
http://mail.google.com/a/oakland.edu/accounts/o8/id找不到 OpenID 服务器
openid.php:
<?
<?php
require 'openid.php';
try {
# Change 'localhost' to your domain name.
$openid = new LightOpenID('http://webprolearner.ueuo.com');
if(!$openid->mode) {
if(isset($_GET['login'])) {
$openid->identity = 'mail.google.com/a/oakland.edu/accounts/o8/id';
header('Location: ' . $openid->authUrl());
}
?>
<form action="?login" method="post">
<button>Login with Google</button>
</form>
<?php
} elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
【问题讨论】:
标签: php openid lightopenid