You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I had difficulties with your example.php, because the openId provider that I
was using as test (Hyves.nl) uses POST callbacks rather than GET. So your login
example failed because it only looks at $_GET['openid_mode']. I fixed this, and
I also merged the Google example into the regular example (might be more
convenient for most people). You might not agree with the latter, however here
is the code.
Thanks!
Niels
>---
try {
$openid_mode = '';
if (isset($_GET['openid_mode']) ){
$openid_mode=$_GET['openid_mode'];
} else if (isset($_POST['openid_mode'])) {
$openid_mode=$_POST['openid_mode'];
}
if($openid_mode=='' ) {
if (isset($_POST['openid_identifier'])) {
$openid = new LightOpenID;
// Google only provider
if (strpos($_POST['openid_identifier'],'google')!==FALSE ||
strpos($_POST['openid_identifier'],'gmail')!==FALSE) {
$openid->identity = 'https://www.google.com/accounts/o8/id';
} else {
$openid->identity = $_POST['openid_identifier'];
}
header('Location: ' . $openid->authUrl());
}
?>
<form action="" method="post">
OpenID: <input type="text" name="openid_identifier" /> <button>Submit</button>
</form>
<?php
} elseif ($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();
}
Original issue reported on code.google.com by nielsba...@gmail.com on 22 Nov 2010 at 12:47
The text was updated successfully, but these errors were encountered:
You've broken the support for google profiles while merging the examples (urls
like http://google.com/profiles/login). Don't do things like guessing what a
openid identifier might be -- it's wrong, and can easily cause problems. And
even if it doesn't, it's confusing to the user, because it works differently on
different websites. That's one of the reasons why google-example.php has a
button.
That said, I'll push a commit soon, that fixes it.
Original comment by mewp...@gmail.com on 22 Nov 2010 at 11:43
Original issue reported on code.google.com by
nielsba...@gmail.com
on 22 Nov 2010 at 12:47The text was updated successfully, but these errors were encountered: