Showing posts with label facebook-javascript-sdk. Show all posts
Showing posts with label facebook-javascript-sdk. Show all posts

Sunday, March 11, 2018

With 'picture' in Facebook's Feed Dialog deprecated how can I post an image link?

Leave a Comment

I've been using Facebook's Feed Dialog to let users on a site share content on their Facebook feed. On their feed there would be a picture that serves as a link to the page on my site, with some text below it (name, caption and description fields). All of these - picture, name, caption and description are now deprecated and stop working on July 17th. Is there any other way to achieve this functionality using a different method?

1 Answers

Answers 1

You need to use the Open Graph actions method described at the bottom of this page here in the FB dev docs.

Trigger a Share Dialog using the FB.ui function with the share_open_graph method parameter to share an Open Graph story.

Try this within your code to specify a custom image, title, description or link on your FB shares:

    // this loads the Facebook API     (function (d, s, id) {         var js, fjs = d.getElementsByTagName(s)[0];         if (d.getElementById(id)) { return; }         js = d.createElement(s); js.id = id;         js.src = "//connect.facebook.net/en_US/sdk.js";         fjs.parentNode.insertBefore(js, fjs);     }(document, 'script', 'facebook-jssdk'));      window.fbAsyncInit = function () {         var appId = '1937011929814387';         FB.init({             appId: appId,             xfbml: true,             version: 'v2.9'         });     };      // FB Share with custom OG data.     (function($) {          $('.fb_share_btn').on('click', function (event) {             event.preventDefault();             event.stopPropagation();             event.stopImmediatePropagation();                  // Dynamically gather and set the FB share data.                  var FBDesc      = 'Your custom description';                 var FBTitle     = 'Your custom title';                 var FBLink      = 'http://example.com/your-page-link';                 var FBPic       = 'http://example.com/img/your-custom-image.jpg';                  // Open FB share popup                 FB.ui({                     method: 'share_open_graph',                     action_type: 'og.shares',                     action_properties: JSON.stringify({                         object: {                             'og:url': FBLink,                             'og:title': FBTitle,                             'og:description': FBDesc,                             'og:image': FBPic                         }                     })                 },                 function (response) {                 // Action after response                 })         })      })( jQuery ); 
Read More

Thursday, March 8, 2018

facebook graph api: understanding offset_y offset_x API

Leave a Comment

Hello I am trying to understand what offset_y means in facebooks graph API https://developers.facebook.com/docs/graph-api/reference/cover-photo/.

y_offset: When greater than 0% but less than 100%, the cover photo overflows vertically. The value represents the vertical manual offset (the amount the user dragged the photo vertically to show the part of interest) as a percentage of the offset necessary to make the photo fit the space.

I have tried using the solution in facebook graph api: offset_y offset_x, but it does work.

for example, this event https://www.facebook.com/events/164312630996898/. The event picture has a css top offset of -3px:

enter image description here

In order to calculate this, I will attempt to use the method in facebook graph api: offset_y offset_x

The image is 500x622px (when resized to fit), the event image space is 500x262px. 622px-262px = 360px. using the facebook graph API (https://developers.facebook.com/tools/explorer?method=GET&path=164312630996898%3Ffields%3Dcover&version=v2.12) gives an offset-y of 9: enter image description here

so 9% of 360px is, 32.4px, but the actual answer should be 3px.

any help would be greatly appreciated!

1 Answers

Answers 1

So I have experimented with this a lot and I am 100% sure the offset_x, offset_y are not properly documented and may not be even sufficient in many cases to even depict the offset

In my case I used two images listed below and did some experiment with different drags

First Image

Second Image

The event was created on

https://www.facebook.com/events/901430313369669/

Event

And data collected was below for the above 2 images

Data collected

For the 2nd image you can see that whether i kept the image left aligned, right aligned or center aligned the offset were always 0. But the left was still calculated. This means facebook is not share the offset information correctly. It is most probably a bug based on observation from second image.

Also weird thing is the -77, 177 entries from the first image

Offset

Read More

Sunday, October 15, 2017

FB.logout: what should it do in term of later calls to FB.getLoginStatus?

Leave a Comment

According to https://developers.facebook.com/docs/reference/javascript/FB.logout/

The method FB.logout() logs the user out of your site

what does this mean in terms of later calls to FB.* functions?

Specifically, I'm observing that even though the response to FB.logout has a status of "unknown", after the logout has completed, calling FB.getLoginStatus returns a status of "connected", when passing true as a second parameter or after a page refresh.

This is unexpected to me... perhaps I'm misunderstanding what "logs the user out of your site" means: what does it mean in terms of the FB.* functions? I'm looking to, as best as possible, reverse the process of FB.login. How can this be done?


Update: I was testing at http://localhost:8080. When on http://fbtest.charemza.name/ I realise logout works as I expect, but logout on localhost:8080 logout does not seem to work, i.e. exhibits the problem above. To be clear, no errors appear in the console at any point. The code of the page is below.

To change the question slightly, why does it do this on localhost:8080, and is there a way to develop logout locally where the behaviour is the same as on the public web?

<!doctype html> <html lang="en"> <head>   <meta charset="utf-8">   <title>Facebook Test</title> </head>  <body>   <script>     window.fbAsyncInit = function() {       FB.init({         appId      : '1524395480985654',         cookie     : true,         xfbml      : false,         status     : false,         version    : 'v2.10'       });        FB.AppEvents.logPageView();        };      (function(d, s, id){        var js, fjs = d.getElementsByTagName(s)[0];        if (d.getElementById(id)) {return;}        js = d.createElement(s); js.id = id;        js.src = "https://connect.facebook.net/en_US/sdk.js";        fjs.parentNode.insertBefore(js, fjs);      }(document, 'script', 'facebook-jssdk'));      document.addEventListener("DOMContentLoaded", function(event) {       document.getElementById("loginButton").addEventListener("click", function() {         FB.login(function(response) {           console.log('FB.login', response);         });        });        document.getElementById("logoutButton").addEventListener("click", function() {         FB.logout(function(response) {           console.log('FB.logout', response);         });       });        document.getElementById("getLoginStatusButton").addEventListener("click", function() {         FB.getLoginStatus(function(response) {           console.log('FB.getLoginStatus', response);         }, true);       });     });   </script>     <button id="loginButton">FB.login()</button>   <button id="logoutButton">FB.logout()</button>   <button id="getLoginStatusButton">FB.checkLoginStatus()</button> </body> </html> 

2 Answers

Answers 1

The reason this doesn't work for you on localhost is that you have set the App domains to localhost, app domains should only be set when you are using a actual domain.

So I went through a debugging session on the Javascript loaded by FB JSSDK and found below line

document.cookie = n + "=" + o + (o && p === 0 ? "" : "; expires=" + r) + "; path=/" + (q ? "; domain=" + j : "") 

When you have no App domains set then q=null and j=.localhost. So no domain is set on the cookie and hence it all works great.

When you have a App domains set as localhost, q=true and j=.localhost. So when the code tries to set domain it uses something like below

"fbsr_370363483399260=q8i_dn0F22UweXRMNff0tf5WpfYOelZ0vsjtIKrDhzw.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI....A4NTgwNzg1MzEwOTk5In0; expires=Fri, 13 Oct 2017 14:00:01 GMT; path=/; domain=.localhost"

This doesn't work on localhost and doesn't allow setting the cookie at all. document.cookie will not set any cookie not related to current page. But if I override j=localhost in console the cookies work. That is the reason you shouldn't set App domain to localhost when testing locally

FB Cookies on local

Answers 2

The method FB.logout() logs the user out of your site and, in some cases, Facebook.

This means:

  1. Steps: User not logged in Facebook -> Logins into your app

    On FB.Logout: User will log out from your app and Facebook

  2. Steps: User not logged in Facebook -> Logins into some other app. -> Logins into your app

    On FB.Logout: User will log out from both the apps and Facebook

  3. Steps: User already logged in Facebook -> Logins into your app

    On FB.Logout: User will log out from your app but not facebook.

(Note: If User is not logged in Facebook, he/she will have to first log into Facebook and then your app)

So in all cases the user has to be logged in with facebook so when you use FB.getLoginStatus following things will happen:

  1. User Logged into Facebook and your app is authenticated.

    FB.getLoginStatus returns connected

  2. User logged into Facebook but has not authenticated your application

    FB.getLoginStatus returns not_authorized

  3. Now if the user logs out of Facebook or logs out of your app (which may results in log out from Facebook). (This seems to be your case) Because in this case, the app doesn't even make an attempt to connect to facebook, that's why unknown.

    FB.getLoginStatus returns unknown

EDIT:

Now in third case it will always return unknown because it doesn't even try to connect to Facebook. So if you pass force true, it will attempt to make a ajax call to Facebook and will return you the status (should either be connected or not_authorized).

function getLoginStatus(cb, force) {   if (!Runtime.getClientID()) {     Log.warn('FB.getLoginStatus() called before calling FB.init().');     return;   }   if (cb) {     if (!force && loadState == 'loaded') {       cb({         status: Runtime.getLoginStatus(),         authResponse: getAuthResponse()       });       return;     } else {       Auth.subscribe('FB.loginStatus', cb);     }   }   if (!force && loadState == 'loading') {     return;   }   loadState = 'loading';   var lsCb = function lsCb(response) {     loadState = 'loaded';     Auth.inform('FB.loginStatus', response);     Auth.clearSubscribers('FB.loginStatus');   };   fetchLoginStatus(lsCb); } 

Above function taken from Facebook SDK will fetchLoginStatus if force is true.

Read More

Tuesday, June 13, 2017

Facebook Marketing API Set action_attribution_windows No views

Leave a Comment

When using the Facebook marketing api i would like to download the actions without the action_attribution_windows 1d_view option.

I currently use the following setup;

# Ad import fields fields = [     # Ad meta data     Insights.Field.account_id,     Insights.Field.account_name,     Insights.Field.campaign_id,     Insights.Field.campaign_name,     Insights.Field.adset_id,     Insights.Field.adset_name,     Insights.Field.ad_id,     Insights.Field.ad_name,     Insights.Field.date_start,     Insights.Field.date_stop,     # Ad metrics     Insights.Field.cpc,     Insights.Field.cpm,     Insights.Field.cpp,     Insights.Field.ctr,      Insights.Field.impressions,     Insights.Field.reach,     Insights.Field.spend,     Insights.Field.inline_link_clicks,      Insights.Field.clicks,     Insights.Field.actions      ]  # Ad parameters params_ad = {     'level': Insights.Level.ad,      'limit': limit if limit > 0 else None,     'time_range': {         'since': since,         'until': until     },     'action_attribution_windows': ['28d_click'], }  # Download data from Facebook my_insights = my_account.get_insights(fields=fields, params=params_ad) 

This however downloads the data as 28d_click with 1d_view. As i think it defaults at 1d_view when no value is given.

How would i disable the 1d_view?

1 Answers

Answers 1

How would i disable the 1d_view?

You can't, you would need to specify the number of days if you use action_attribution_windows otherwise as you guessed, it would default to 1d_view

From the docs, action_attribution_windows can be given custom day parameters as it is a: list

However you can specify 7d_view, 28d_view if you don't need 1d_view.

We measure the actions that occur when a conversion event occurs and look back in time 1-day, 7-days, and 28 days

Reference:

https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/

https://developers.facebook.com/docs/marketing-api/insights/v2.9

Please comment for more information.

Read More

Tuesday, April 4, 2017

FB.login() fails with “Unsafe JavaScript attempt to initiate navigation for frame” on Android Chrome but not desktop Chrome

Leave a Comment

I have a Facebook JS SDK login flow here: https://web.triller.co/#/user/login

When the user taps the Facebook button, the following function is executed:

loginFacebook() {     const fbPromise = new Promise((resolve, reject) => {         FB.login(resp => {             if (resp.authResponse)             {                 resolve(resp.authResponse.accessToken);             }             else             {                 console.log(resp);                 reject(new Error('Facebook login canceled or failed.'));             }         });     });      return fbPromise         .then(accessToken => api.postJson('user/login_facebook', { accessToken }))         .then(this._handleLogin.bind(this)); } 

Basically, it calls FB.login(), and expects to receive a valid resp.authResponse. Unfortunately, it doesn't, even after successfully authenticating on the Facebook popup/tab. Instead, we receive { authResponse: undefined, status: undefined } and the following error from the browser:

Unsafe JavaScript attempt to initiate navigation for frame with URL 'https://m.facebook.com/v2.8/dialog/oauth?foo=bar' from frame with URL 'https://web.triller.co/#/user/login?_k=cmzdb6'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.

The error occurs immediately after authenticating within the Facebook popup/tab, and it only occurs on Android Chrome. Desktop Chrome (on a Mac) does not show the same error. Safari on iOS does not show the error, either.

Any thoughts on what's going on? Why the difference between Android Chrome and desktop Chrome? Could it have something to do with the hash in the URL?

4 Answers

Answers 1

In desktop this issue can be caused by XFINITY Constant Guard Protection Suite Chrome extension. Disble it and problem will be solved.

In Android, try removing XFINITY or similar security extensions or applications (Norton security antivirus).

https://developer.salesforce.com/forums/?id=906F00000008qKnIAI

Answers 2

I think it fails because of the m.facebook.com/... based on this https://en.wikipedia.org/wiki/Same-origin_policy#Origin_determination_rules (see the case for http://en.example.com/dir/other.html and why it fails). Although it shouldn't based on what I've done with the fb api this is weird, try making a cors request instead as a workaround?

Answers 3

This is a known issue here https://code.google.com/p/android/issues/detail?id=20254.

When the window.open is called without proper arguments, it will not be opened as expected.

It can be overcome by either updating the browser (for client, check the browser version and if old one, force them to update it).

Otherwise (not applicable for you since you can't change the FB function), pass the correct arguments to window.open

Answers 4

You can also have this implemented this way. This worked for me for all devices. Please read comments to understand the flow and code.

// THIS IS JS FILE YOU NEDD TO USE <script></scriipt> Tag on html page to include js code.        /*  1. Javascript SDK init ******************************************************************************************************* 1  */       window.fbAsyncInit = function () {         FB.init({             appId: '*****yorAPP-ID****',             xfbml: true,             version: 'v2.4'         });     };       (function (d, s, id) {         var js, fjs = d.getElementsByTagName(s)[0];         if (d.getElementById(id)) {             return;         }         js = d.createElement(s);         js.id = id;         js.src = "//connect.facebook.net/en_US/sdk.js";         fjs.parentNode.insertBefore(js, fjs);     }(document, 'script', 'facebook-jssdk'));      window.fbAsyncInit = function () {     FB.init({         appId: 'enteYourAppIDHere',         cookie: true,  // enable cookies to allow the server to access                        // the session         xfbml: true,  // parse social plugins on this page         version: 'v2.2' // use version 2.2     });       // Now that we've initialized the JavaScript SDK, we call     // FB.getLoginStatus().  This function gets the state of the     // person visiting this page and can return one of three states to     // the callback you provide.  They can be:     //     // 1. Logged into your app ('connected')     // 2. Logged into Facebook, but not your app ('not_authorized')     // 3. Not logged into Facebook and can't tell if they are logged into     //    your app or not.     //     // These three cases are handled in the callback function.       // FB.getLoginStatus(function(response) {     //   statusChangeCallback(response);     // });    };    // Load the SDK asynchronously  (function (d, s, id) {     var js, fjs = d.getElementsByTagName(s)[0];     if (d.getElementById(id)) return;     js = d.createElement(s);     js.id = id;     js.src = "//connect.facebook.net/en_US/sdk.js";     fjs.parentNode.insertBefore(js, fjs);  }(document, 'script', 'facebook-jssdk'));          /*     2. HTML FB Button     USE THIS HTML CODE ON YOUR PAGE ********************************************************************************************* 2  */    // ADD Button to HTML       /*      3. When User CLICK on FB LOGIN button it will call this function after you get response from fb ***************************** 3.1  */  // This function is called when someone finishes with the Login  // Button.  See the onlogin handler attached to it in the sample  // code below.  function checkLoginState() {     FB.getLoginStatus(function (response) {         statusChangeCallback(response);     });  }    //Above function is calling below function and passing response in it.  // According to response we check login was success or not ******************************************************************* 3.2    // This is called with the results from from FB.getLoginStatus().  function statusChangeCallback(response) {     console.log('statusChangeCallback');     console.log(response);     // The response object is returned with a status field that lets the     // app know the current login status of the person.     // Full docs on the response object can be found in the documentation     // for FB.getLoginStatus().     if (response.status === 'connected') {         // Logged into your app and Facebook.         // So Login was success so you can do your stuff here... I am calling this below function on success         testAPI();     } else if (response.status === 'not_authorized') {         // The person is logged into Facebook, but not your app.         document.getElementById('status').innerHTML = 'Please log ' +             'into this app.';     } else {         // The person is not logged into Facebook, so we're not sure if         // they are logged into this app or not.         document.getElementById('status').innerHTML = 'Please log ' +             'into Facebook.';     }  }      /*  So if success logged in we call this functiom  Here we use FB graph API to get user's data...  ***************************************************************************** 3.3  */    // Here we run a very simple test of the Graph API after login is  // successful.  See statusChangeCallback() for when this call is made.    // Here we run a very simple test of the Graph API after login is  // successful.  See statusChangeCallback() for when this call is made.  function testAPI() {     console.log('Welcome!  Fetching your information.... ');     FB.api('/me', function (response) {         console.log(JSON.stringify(response));         var uname = response.name;         var fbid = response.id;         console.log(response.email);     });  }
<fb:login-button scope="public_profile,email" onlogin="checkLoginState();" login_text="Sign in with Facebook" data-size="xlarge">  </fb:login-button>

Read More

Tuesday, March 21, 2017

Facebook social sigin-in javascript sdk won't load in Chrome or FF

Leave a Comment

Update 1

I started with angular quickstart and only added facebook's javascript, however, it won't load:

<script type="text/javascript" src="//connect.facebook.net/en_US/sdk.js"></script> 

I am Using Facebook JavaScript API to create login in an angular 2 app, but running into the following:

TypeError: FB.login is not a function

index.html (Elided for brevity)

<script type="text/javascript" src="//connect.facebook.net/en_US/sdk.js"></script>  <script>     System.import('app').catch(function (err) {console.error(err);}); </script> 

I noticed the script does not seem to load correctly, following is from Chrome devtools:

enter image description here

Angular 2 Component

declare const FB: any;  @Component({   // usual suspects here }) export class LoginComponent implements OnInit {  constructor() {   FB.init({     appId: 'my-app-id',     cookie: false,     xfbml: true,     version: 'v2.5'   });      }   ngOnInit(): void {         FB.getLoginStatus(response => {       ....     });  }   onSignin(socialMedia: string): void {    FB.login(); // The errant line  } } 

Am I supposed to do something like the following? as outlined here

(function(d, s, id){     var js, fjs = d.getElementsByTagName(s)[0];     if (d.getElementById(id)) {return;}     js = d.createElement(s); js.id = id;     js.src = "//connect.facebook.com/en_US/sdk.js";     fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); 

3 Answers

Answers 1

Answering this for the benefit of others....

It was ghostery plugin which was (among other things) blocking 'social signin'.

Answers 2

i think insert script library of fb in your main html file.Also make sure that the script provided by the fb developers are inserted in your code that solve the problem.follow the link https://developers.facebook.com/docs/javascript/quickstart

Answers 3

Don't run FB.init directly, You should do:

declare var window:any; 

and then in your constructor or ngInit Method use FB Async Method:

    window.fbAsyncInit = function() {             FB.init({               appId: appID,               xfbml: true,               version: 'v2.5'             });     };      (function(d, s, id){         var js, fjs = d.getElementsByTagName(s)[0];         if (d.getElementById(id)) {return;}         js = d.createElement(s); js.id = id;         js.src = "//connect.facebook.com/en_US/sdk.js";         fjs.parentNode.insertBefore(js, fjs);     }(document, 'script', 'facebook-jssdk')); 

fbAsyncInit automatically get trigger when facebook sdk loads.

See more at Facebook quick start

Read More

Saturday, January 21, 2017

How to get Facebook live video instance without xfbml.ready?

Leave a Comment

I'm embedding a live Facebook video on my web page and need to place event handlers on the video. For example, I'd like to know if the video has been paused.

With regular videos (non-live) videos, I'm able to do this by subscribing to the events using the method outlined in the Facebook documentation. Here are the docs: https://developers.facebook.com/docs/plugins/embedded-video-player/api and my example code:

FB.Event.subscribe('xfbml.ready', function (msg) {   if (msg.type === 'video') {     fplayer = msg.instance;     fplayer.subscribe('paused', facebookPauseEventHandler);   } }); 

The problem is, when embedding a live video instead of an "on-demand" or pre-recorded video that has an end, the xfbml.ready event never fires. This is detrimental because you need the response, in this case "msg", in order to subscribe to the Facebook events.

I've tried using 'xfmbl.rendered' instead but the msg received when the event is fired is just '1'.

I also had tried placing event handlers on the events conducted by the player itself vs using msg.instance, but this is not possible due to cross origin policy issues (the Facebook player is inside an iFrame).

This post => Unmute facebook live video is also asking a similar question that relates to xfbml.ready not firing.

Thanks for your help.

0 Answers

Read More

Saturday, April 23, 2016

How to solve OmniAuth NoAuthorizationCodeError when using Facebook JS SDK in a React Flux App?

Leave a Comment

I've built a full-stack app in React using Flux. I've been stuck for days on trying to get facebook login to work using the javascript SDK. Inside of a React component I have:

  signInToFacebook: function() {     ApiUtil.signInToFacebook();   },    componentDidMount: function() {     window.fbAsyncInit = function() {       FB.init({         appId      : 'MY_APP_ID',         cookie     : true,  // enable cookies to allow the server to access                           // the session         xfbml      : true,  // parse social plugins on this page         version    : 'v2.5' // use graph api version 2.5       });     };      (function(d, s, id){        var js, fjs = d.getElementsByTagName(s)[0];        if (d.getElementById(id)) {return;}        js = d.createElement(s); js.id = id;        js.src = "//connect.facebook.net/en_US/sdk.js";        fjs.parentNode.insertBefore(js, fjs);      }(document, 'script', 'facebook-jssdk'));   },    render: function() {     return (       <div className="fb-login-button" onClick={this.signInToFacebook}>         {"Sign in with Facebook"}       </div>     )   } 

Basically, I have a div which when clicked calls a function "signInToFacebook", which then calls another function in ApiUtil called "signInToFacebook", which is the following:

var ApiUtil = {   signInToFacebook: function() {     FB.login(this.signInOmniAuth);   },    signInOmniAuth: function(response) {      $.ajax({       method: 'GET',       url: '/auth/facebook/callback',       success: function() {         console.log("returned in apiutil");         debugger;       }     });   } } 

When I click on the div, the ajax request is made, but I get a 500 Internal Server Error:

OmniAuth::Strategies::Facebook::NoAuthorizationCodeError at

/auth/facebook/callback

must pass either a code (via URL or by an fbsr_XXX signed request cookie)

omniauth-facebook (3.0.0) lib/omniauth/strategies/facebook.rb, line 151

Here is the parsed request Header:

Accept:/ Accept-Encoding:gzip, deflate, sdch Accept-Language:en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4,de;q=0.2 Cache-Control:no-cache Connection:keep-alive Cookie:_Project_session=K3o2K3NxbnBXZ2w4c1lqZXdtMFhoeFdtSndSSm95OEtEZGdVQVJnNkx0L2JobzVSZmh4MHM4VHN4OWo0dHJjU3p0dlV6ZHhIL3dleG9hOCtRazF0dmhCSWI5aGgvcTBaVXFvS0wzcXdIV1ZmMm9wTGZ2ZG81enBjcjR6Y0VnKzBUTThNR3RoM1ZnRkozMUQ0cnhkbzVnPT0tLStsamIzek01R2RRMWllKy9YMlVPSWc9PQ%3D%3D--60dad32af96176a6d60eb9c5b151513bab2169a3; fbsr_1691421964447573=NvJPbYyDyKzi6NUQMUMCTWXi3QLVP6J9vG5OIfSBmT8.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUMwUmhhUjgwWWxNQUhYNFlFZUNHNy1QR01tb1ZkWDU0SFBZLXo2eUNJREF3X0trTzJZVmpaS0FmNXlJNldERkRrMUdRWndTX1NBSWJJSzZUQUpYOU1sOS1sbjNUWUl3anJiOUx5V3plUzRGLWloLXNLdUp2NHBNeFFGZGREZ05QemwyLVNnMEV6QlZyQ0FwdXItNU5Ncnh5dXhHT3VQcE4tczlFRjA5U1FtVkFrRGc2cVNSTE8xVmpraE5ZMnNoclpyMDBpemx4ZVY1ejhKMUN3T3JKRzF3b3FjVkZBX01hQnk0cXlFOFRfN2ROYnd6azdXamoxc2VMSlNRQ2ZhVGRBbUtCV0VwQ1M5cXl1bHZDdnRTaTktTTZBLXpuQ3JkMUJneGxFdVhiUzJLLUx3WUlydk42NVlzcnB5N0t0bFpXNmpmVGpZUEhjVGQ2TF8xQ0paUzNnMzRISkZkeGdiQV9wVF9UMlVwRF9sMnciLCJpc3N1ZWRfYXQiOjE0NjA1NzA0NTUsInVzZXJfaWQiOiIxMDE1Mzk4NTE5NzE2MjA0MCJ9 Host:localhost:3000 Pragma:no-cache Referer:http://localhost:3000/ User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 X-CSRF-Token:NKgNvTOCLRjE9l0lJwl3MF8yFfXH5LuLjG3NLrmD4I1FIgRoOzT7uN8rvyxNG4HSQ/2bKcVBojQ7blmuI+qWZQ== X-Requested-With:XMLHttpRequest

When I look at the request cookies, there is a fbsr_XXX cookie where XXX is my APP_ID.

I have tried using the solution to this question, basically making my ajax request as follows:

  signInToFacebook: function() {     FB.login(this.signInOmniAuth);   },    signInOmniAuth: function(response) {      $.ajax({       method: 'GET',       url: '/auth/facebook/callback',       data: {signed_request: response.authResponse.signedRequest},       success: function() {         console.log("returned in apiutil");         debugger;       }     });   }, 

But I still get the same 500 error.

0 Answers

Read More