Created
March 19, 2013 12:20
-
-
Save kayalshri/5195638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
@author : Giriraj Namachivayam | |
@date : Mar 03, 2013 | |
@demourl : http://ngiriraj.com/socialMedia/oauthlogin/google.php | |
@document : http://ngiriraj.com/work/http://ngiriraj.com/work/google-connect-by-using-oauth-in-php/ | |
@license : Free to use | |
@History : V1.0 - Released oauth 2.0 service providers login access | |
*/ | |
include "socialmedia_oauth_connect.php"; | |
$oauth = new socialmedia_oauth_connect(); | |
$oauth->provider="Google"; | |
$oauth->client_id = "730362277469-tbeqm6l332n1al4pnfdgb83786a6g3f2.apps.googleusercontent.com"; | |
$oauth->client_secret = "xxxxxxxxxxxxxxxxxxxx"; | |
$oauth->scope="https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.me https://www.google.com/m8/feeds"; | |
$oauth->redirect_uri ="http://ngiriraj.com/socialMedia/oauthlogin/google.php"; | |
$oauth->Initialize(); | |
$code = ($_REQUEST["code"]) ? ($_REQUEST["code"]) : ""; | |
if(empty($code)) { | |
$oauth->Authorize(); | |
}else{ | |
$oauth->code = $code; | |
$getData = json_decode($oauth->getUserProfile()); | |
$oauth->debugJson($getData); | |
/* redirect here */ | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment