CURL should be enable for facebook application? - facebook

I am new to facebook application development.
I try to create facebook as per following url.
http://net.tutsplus.com/tutorials/javascript-ajax/design-and-code-an-integrated-facebook-app/
But I am getting following error.
I have hosted application on shared web hosting and do we need to have CURL enable to
facebook application.
I have CURL disabled on shared web hosting.
Error
Sorry, the application you were using is experiencing a problem. Please try again later.
I try to check from my local XAMPP and got CURL error and after I enable CURL error solve.
Thanks

Here's an article on how to get CURL enabled on PHP servers:
http://www.wallpaperama.com/forums/how-to-find-out-if-php-is-compiled-with-curl-extension-installed-enabled-t1576.html

Related

Stitch Facebook authentication returns "AuthError"

Using the Stitch Facebook authentication provider with the Web/JS SDK the auth flow seems to work fine up until the redirect is done back to the Stitch servers.
loginFB() {
const credentialFB = new FacebookRedirectCredential();
this.$stitch.auth.loginWithRedirect(credentialFB);
}
It then returns this error from the Stitch service:
https://eu-west-1.aws.stitch.mongodb.com/api/client/v2.0/auth/callback?code=AQClGc41QMShUyLT0FOIyGM4ZEi8FPEj4qSHF022F6gGqdIYrgBmop7QVWVuKQYH-CNCtGNSpOWJSVu9_nZwrHauMVrKt6CeswVIgRs5iQpt84YPFkg35BXZHf_PGcpvTsTBt2HC4B_yyYCcYCc4Ccn_wlCkG9bu-LwfKOePDtTYOJahys-xflBC8IyveMZIAK9lc00orXqC7zooETDgrE8KdoDw6uE8Q8zT_XMD7fGmCB7_-kcnmE9wScgC2Vsb38_AG4dkazNG_IenKpbo0s7vfDDfRLPawXpeWpSue_PRYLGSoKUB1UyWSNiujuq3ClE&state=nBspwBNKIdbEUxcyFdrHDudGKbuJhfjVTcHpzyMjSi-uImn5LQG3XtsgqRUGsB_UIEVnAIi6dswt5FwV90kphQ%3D%3D#=
error: "error exchanging access code with OAuth2 provider"
error_code: "AuthError"
link: "https://stitch.mongodb.com/groups/5ded6422f2a30b6096c347b8/apps/5dfdd120fab085de276dacb2/logs?co_id=5e176295f9d51cd518d60dc6"
Following the link in the error message we arrive at the Stitch logs which says the same thing.
I have followed the official docs (Google Auth works wonders, no worries there) for setting it up and tested the following:
Modified Redirect URIs, tested on hosted (https / http) and localhost.
Configured a Test App in Facebook dev
Tested the various settings for the auth in Facebook console.
Enable forced Re-auth in Facebook, I must then provide password and once that completes same error.
Trying to find information on this error in the official docs or here on Stackoverflow has yielded no results unfortunately. Could someone help explain how to get around this error?
Docs:
https://docs.mongodb.com/stitch/authentication/facebook/
https://docs.mongodb.com/stitch/tutorials/guides/todo-guide-facebook/
The error shown was due to a faulty app secret in the Auth provider section in Stitch. Once that was mended to a correct secret from the Facebook App the login worked as intended. This error should be mentioned somewhere in stitch docs but does not to be documented there at the time of writing this.

Using Facebook & Twitter API's on the same local deployment

I am trying to build an application on my local machine using Twitter's OAuth 1.1 API and Facebooks SDK v4 both for PHP.
Both of these mechanisms redirect the user to prompt for permission and redirect back to website. I can get both working but they will not work under the same local url.
I set everything up for Facebook on localhost without any issues but twitter (staggeringly) does not allow using localhost (see here How to test the twitter API locally?). So instead I set up a virtual host using my Mac based MAMP installation and added that url to both Twitter and Facebook applications. Now Facebook does not allow me to use my virtual host. When the prompt for permissions happens and Facebook redirects back to my site, when I try and retrieve the session using getSessionFromRedirect() it returns NULL. This does not happen if I run the same code using localhost.
I have tried using 127.0.0.1 but Facebook does not allow this either (error is invalid because it is a Facebook url!), but Twitter does!?!
Has anyone else had any problems with this or does anyone have any pointers that would help me to test both of these on the same deployment.
Many thanks in advance.

Facebook [function.file-get-contents]: failed to open

I am geting function.file-get-contents failed to open when i try to connect with server , my server fails to connect ,same application work in all server but in my server i am getting this error , Any solution , is that server CONFIG Issue ..
YOU CAN CHECK SERVER Config here http://gomandi.com/phpinfo.php
In the last few days I saw a few complaints about file_get_contents not working well when trying to access facebook api using it.
Take a look at these threads:
Getting 404 Error from Facebook Graph API
Facebook Auth with high traffic sites: empty access tokens, empty /me
Facebook API 400 Bad Request
You might find out what's wrong there. I suggest that you try to use something other than file_get_contents, such as curl, which was suggested in those threads as well (along side some code snippets)

How to run Facebook's curl codes?

Im new to php n curl.. Im going to use Facebook's OGP for my facebook app that im using in my website..I created OPG setings for publish my app activities to the users profile.
https://developers.facebook.com/docs/beta/opengraph/tutorial/
After i have setup accouring to the Tutorial(above url) they give me curl code like
curl -F 'access_token=AAACAwq1JHZA0BAA94uB50n7O71B6PmMUsFAydKBKCv1HcdJw9NwK8MZC83vL2YqUXojQ0aXH8EBjTweKHQTr4bZBKlgkOJ0nB5dBDu6A09UbI0lmXZBs' \
-F 'friend=http://samples.ogp.me/205849716166552' \
'https://graph.facebook.com/me/yalumalu:add'
and
curl 'https://graph.facebook.com/me/yalumalu:add?access_token=AAACAwq1JHZA0BAA94uB50n7O71B6PmMUsFAydKBKCv1HcdJw9NwK8MZC83vL2YqUXojQ0aXH8EBjTweKHQTr4bZBKlgkOJ0nB5dBDu6A09UbI0lmXZBs'
I don't know how to run these codes in my site..Tutorial says something else there no curl codes in tutorial that given by facebook.. I tried alot.. Someone please help me to do this..
cURL is a simple way to HTTP GET/POST/DELETE requests.
If you need to achieve similar behaviour in your site you need to choose a language that supports sending these requests.
For example you can use PHP and cURL options as well as the PHP SDK or you can use JavaScript to do the same with the JS SDK

Test OAuth Login Redirection for Facebook

I'm building an ASP.NET MVC application that shows information from Facebook. However, if I'm debugging the website locally without a public HTTP endpoint, how can I test the authentication to grab the OAuth token to ensure my app can pull the correct information?
If you mean running in localhost . . . take a look at this question:
Running Facebook application on localhost