I'm looking for a login system like stackoverflow for my project, and for that I googled many scripts but not working like stackoverflow login system work. Stackoverflow using JQUERY Simple OPENID for login authentication. But jquery openid which i downloaded from its original source is incomplete package. The form action predefined in jquery simple openid package is missing or not available. I know this action will be given by user itself but i want the script that will handle authentication at backend just like stackoverflow. I need a backend handler script which store accesstoken and and refresh token in database and reuse these accessTokens. Script supporting language might be java or php
Asked
Active
Viewed 1,077 times
2 Answers
0
Following link could be helpful in order to integrate the OpenId
How to integrate OpenId Login System
For Example code please refer to the below link
Example Code
<?php
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require 'openid.php';
try {
# Change 'localhost' to your domain name.
$openid = new LightOpenID('localhost');
if(!$openid->mode) {
if(isset($_GET['login'])) {
$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($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();
}
Community
- 1
- 1
Vaibs_Cool
- 6,016
- 5
- 27
- 60
-
The example code i already used and it working but it not working like stackoverflow. After i logging in how to use that code which i got from google after authentication, i want to store that code with user-id and use same code for re-login. and i dont know how to use that code. http://www.google.com/accounts/8/id?id=xxxxxxxxxxxxxxxxxxxxxxxxxxx – Waqas Ghouri Sep 07 '13 at 07:14
0
It is possible to use Server Side code for OpenID authentication. Links:
if you want use PHP:
http://gitorious.org/lightopenid - An PHP 5 library for easy openid authentication
or
https://github.com/openid/php-openid - OpenID library for PHP5