Beruflich Dokumente
Kultur Dokumente
0
This guide will help you in implementing Social Annex Social Login module, please follow the steps
below.
1. Add following javascript on page where you want to display the buttons
<script type=text/javascript>
(function(d){
var js, id = 'socialannex-s13', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//cdn.socialannex.com/partner/{siteid}/s13.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
if(isset($_GET['sa_yahoo']))
{
$url = base64_decode($_GET['sa_yahoo']);
yahoopost($url,$_POST);
exit();
}
/*end yahoo custom code */
$redirect_uri = "http://yourdomain.com/handlelogin.php"; // must be same as provided in javascript
$secret = "1234"; //Social Annex will provide this to you, this is secret and must be on server side to maintain security.
$siteid = "7788990"; //Social Annex will provide this for you.
$oauthCode = $_GET['code'];
$params = array(
'client_secret'=>$secret,
'oauth_code'=>$oauthCode,
'redirect_url'=>$redirect_uri,
'siteid'=>$siteid
);
$tokenUrl = "https://api.socialannex.com/s13/v2/service/get_access_token.php?".http_build_query($params);
$accessToken = file_get_contents($tokenUrl);
$token = json_decode($accessToken);
//get profile info
$resUrl = "https://api.socialannex.com/s13/v2/service/get_user_info.php?access_token=".$token->access_token;
$profileJson = file_get_contents($resUrl); // this will contain profile information
"site_id":"9918060",
"user_name":"",
"firstname":"Abrar",
"lastname":"Ahmed",
"image_url":"",
"profile_url":"",
"birth_date":"0000-00-00",
"email":"aahmedsocialannex@yahoo.com",
"gender":"m",
"likes":"",
"city":"",
"state":"",
"country":"",
"phone_number":"",
"interests":"",
"followers_count":"0",
"friends_count":"0",
"languages":"",
"organization":"",
"religion":"",
"time_zone":"",
"photos":"",
"address":"",
"political_view":"",
"relation_status":"",
"books":"",
"movies":"",
"music":"",
"about_me":"",
"tv_shows":"",
"status":"",
"position":"",
"loginprovideruid":"TC2EUZVusIrS60oeKBrRpB_00p004JccPvltD0j0",
"issiteuid":"false",
"issiteuser":"false",
"providers":"yahoo",
"age":"0",
"num_of_logins":"0",
"person_id":"0",
"db_add_date":"2014-01-04",
"db_update_date":"2014-01-06"}
Note: out of all the fields above the only reliable fields that are common to all social networks are the following
ID,UID, firstname, lastname, Email, providers, loginprovideruid, db_add_date, db_update_date
Explanation of the fields
ID this is social annex internal ID.
UID this is social annex generated User ID.
Providers the social network that the user has logged in from, this is a string value of the name of the network.
Loginprovideruid the user ID generated by social network to identify the user on their network.
Siteuid User ID generated by you, when u register a user on your site, (this can only populate if you have called our link
providers api , see detail in point 1 of supplementary api section).
Other fields are self explanatory.
On error:
response JSON with error information.