Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.fbAsyncInit = function () {
- FB.init({
- appId : "xxxx",
- status : true,
- cookie : true,
- xfbml : true,
- oauth : true
- });
- FB.Canvas.setSize({width:$("#mainbody").outerWidth(),height:$("#mainbody").outerHeight()});
- FB.getLoginStatus(function (response) {
- if(response.authResponse){
- if(response.authResponse.userID){
- fbId = response.authResponse.userID;
- $("#hiddenFbId").val(fbId);
- setSession();
- }
- }
- if (response.status === 'connected') {
- FB.api(
- "/me?locale=et_EE",
- function (response) {
- if (response && !response.error) {
- fbName = response['name'];
- fbId = response['id'];
- $("#hiddenFbId").val(fbId);
- fbEmail = response['email'];
- setSession();
- }
- });
- } else {
- FB.login(function (response) {
- if (response.authResponse) {
- if(response.authResponse.userID){
- fbId = response.authResponse.userID;
- $("#hiddenFbId").val(fbId);
- setSession();
- }
- FB.api(
- "/me?locale=et_EE",
- function (response) {
- if (response && !response.error) {
- fbName = response['name'];
- fbId = response['id'];
- $("#hiddenFbId").val(fbId);
- fbEmail = response['email'];
- setSession();
- }
- });
- } else {
- fbDenied = true;
- }
- }, {
- scope : 'public_profile,email,user_likes'
- });
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement