Facebook SDK Upgrade to OAuth - PHP and Javascript

2019-05-25 02:56发布

问题:

I am trying to upgrade our PHP implementation of Facebook SDK for login according to http://developers.facebook.com/blog/post/503/. The changes explained seem easy enough, change session references to user. However there was one small piece missing, the 'next' url param has been replaced by 'redirect_uri'. I ended up with infinite redirects until I found and changed my 'next' url param.

Now, for the Javascript SDK, I noticed the only difference between our current FB.init and the FB.init explained @ http://developers.facebook.com/docs/reference/javascript/ is the 'oauth: true' addition. So I added this to our javascript and refreshed. When I click the FB like button I noticed that headers are not calling oauth like the PHP SDK does, instead it goes straight to login.php which is what I thought was the pre 3.0 behavior. Is our javascript SDK in compliance with the oauth addition?

Also, there is a note at the bottom of http://developers.facebook.com/blog/post/503/ saying "All apps must utilize the new OAuth flows by September 1." Does this mean that if we don't upgrade our FB logins will no longer work?

回答1:

Thanks for the feedback about the 'next' and 'redirect_uri' parameters; we'll look into updating the documentation.

Regarding OAuth compliance, as long as you're loading the JS SDK from http://connect.facebook.net, e.g. http://connect.facebook.net/en_US/all.js you'll be in compliance with the appropriate standards.

Regarding your second point - you have until October 1 to migrate to OAuth 2.0 as described on the Developer Roadmap. After this time, your FB logins will fail with an error.