A simple facebook app gets Method Post is not allowed error - facebook

I tried a very simple helloworld example facebook app. Basically I have a webpage, only contains one file index.php, which only contains one line: echo "helloworld". I have registered this app as an facebook app, configured the setting, canvas url to http://mydomain/..
I can load the page mydomain/index.php. However, when I load the page http://apps.facebook.com/appid, I got the following error:
The requested method POST is not allowed for the URL ...
I checked apache config, there is no or settings to prevent POST method.
Apache error log ad access log does not say anything.
Do you have any clue how to fix this?
Thanks for your kind help!

The first request a Facebook app makes is a POST request. It seems your server is not accepting them. A common problem is having something like:
http://mydomain.com/index.html
Instead of
http://mydomain.com/index.php
Either way check your HTTP logs you will probably see an error ( possibly 405 ) with more details.

Related

Programatically creating Test Users with cURL using the Facebook v2.1 Graph API

I want to programatically create Facebook Test Users for my Facebook App.
I've been looking at the API docs for the HTTP Facebook Graph API v2.1:
https://developers.facebook.com/docs/graph-api/reference/v2.1/app/accounts/test-users
The section about publishing has led me to believe that I should have adequate permissions to create Test Users programatically with just my app-access-token:
An app access token is required to create new test users for that app.
So I've tried forming a request like this:
curl -v --data "name=foo&access_token=xxxxxxxxxxxxxxxxx" https://graph.facebook.com/v2.1/99999999999999/accounts/test-users
The access_token I am using is my 'App Token' as shown on this page:
https://developers.facebook.com/tools/accesstoken/
It almost works. A new user foo does indeed get created, foo even shows up in the Test Users section on the Facebook App Developer page. However, the request consistently yields a strange response:
< HTTP/1.1 500 Internal Server Error
< WWW-Authenticate: OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
< Facebook-API-Version: v2.1
< ...
{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
I've taken a look at a number of older posts from users on Stack Overflow with similar problems, however, after trying the suggestions in those threads I still face the same problem, I suspect the suggestions in those threads are specific to older versions of the Facebook Graph API.
Can someone please explain what is going wrong? Is this something that I should be able to do from cURL without being logged into Facebook myself?
I just tried again with the exact same cURL request (the next day) and got 200 back from Facebook as expected.
There must have been an issue at Facebook's end. Or their API is super flakey!
You can't use the generated token on their page to test this. You need to generate the token yourself using a previous curl request, and then pass that token into your next one.
See Access Tokens for more information
The app access token can either be one generated by facebook or app_id|secret. However, the endpoint seems to be broken since last night at the moment, I just submitted a question wondering if anybody else has had the same issue.
I don't have a fix, but I have some new data.
This started happening to me yesterday 2014-10-14, sometime between 10 AM and 12 PM PDT. Code and an FB app which had been working previously stopped working, and remains broken today.
Surprisingly, when I look at https://developers.facebook.com/apps/FB_APP_ID/roles/test-users/, I can see the new users.
So the call is "working" in that new users are being created, but it is broken in that we get a 500 code=1 message="An unknown error has occurred."

getting redirect uri mismatch error in google plus despite having no uri mismatch

Please consider the following two websites that I am pinging as shown in the image below:
I have a google plus login icon where a user can click on it and can sign in using his/her google account.
My website where all the login code is residing is say for example xyztesting.com as shown in the image. And all the code related to xyztesting.com resides on the box 10.11.10.12 which has a domain name abctesting.com.
So, when i ping abctesting.com, I get Packets Sent and Received = 4 as shown in the image.
However, when I ping xyztesting.com , I get Request timed out as shown in the image below.
Does anyone knows whether this could be the reason behind why I am getting Redirect URI Mismatch error 400 error whenever a user tries to log in using google plus ?
I have ensured that the REDIRECt URI in the request matches the Registered Redirect URIs which is the most common message displayed when some one encounters this error and this is the most common fix suggested online everywhere.
I have referred to lot of previous related posts, including this one where they talks about making sure that the request URI's should match the registered URI on google developer console.
I have got a feeling that since there is not a dedicated box/server for my website xyztesting.com, google is thowing such error. Please let me know if anyone has experienced such type of error with the situation I have described above?
Sometimes, the redirect uri should be set to "postmessage" not the actual uri.
The documentation is not so clear on that setting.
-Dragonfire

Facebook server-side OAuth 2.0 on localhost:8080 can't get access token missing redirect_uri

There are many other question related to this, but they didn't help me fix my problem.
I'm using the Facebook server-side login for a website, which I want to test locally. The path that initiates the login action is [http://localhost:8080/fblogin] (this redirects to the Facebook login dialogue, and goes from there).
I can successfully get the code, but when I try to exchange that for an access token, I get the following error:
{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191}}
I am providing the redirect_uri, url encoded and it is the same as the one I use to get the first code. Here is the url I'm using to request the access token (with the all-caps query string parameters replaced with their actual values, of course):
https://graph.facebook.com/oauth/access_token?client_id=CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Ffblogin&client_secret=CLIENT_SECRET&code=CODE_FROM_FB
I suspect this might have to do with how my app is set up on Facebook. Here are the values I have set:
Display Name: (an actual display name here)
App Domains: localhost
Contact email: (an actual email here)
Site URL: [http://localhost:8080/fblogin]
What do I need to tweak in the settings to get this to work? Or does this look correct?
By the way, if it makes any difference, I am using the Play! framework, version 2.0.1
After digging around a little more, I found that it was necessary for me to use POST when sending the request from my server to get the access token.
Interesting that using POST worked for you as this didn't for me.
In any case, did you add the query parameters using setQueryParameter()? (see How to make multiple http requests in play 2?)

Facebook API error code 191 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Facebook API error 191
I'm developing a Facebook app. When I attempt to get an access token, I get the following message:
An error occurred with test. Please try again later.
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
https://developers.facebook.com/apps/.../summary
I've configured the app's domain (appsdot.xxx.com), name and other attributes.
What is causing this error, and how do I fix it?
The redirect_uri must contain the Site URL or Canvas URL as defined in your App Settings. I always get this error when I set a redirect_uri that doesn't contain the URLs in App Settings.
I got this error because I had a trailing slash on my Canvas URL and neglected to include the trailing slash in the redirect_uri.
be carefull error is about uri (i spell: Uniform Romeo India) and the most probably you are using word url (i spell: Uniform Romeo Lima) ... do you see the difference???
just add st like this:
redirect_uri: 'YOUR_PAGE_TAB_URL OR CANVAS_URL'
how simple,isnt it?
this just because of URL mistake
whatever website url is specified should be correct.
i mentioned website url as http://localhost:3000/ and domain as localhost
but in my browser i was running http://0.0.0.0:3000/ that was the actual problem so i ran server as localhost:3000 now its working fine. Because we mentioned site url as localhost fb will redirect to same, if we r running 0.0.0.0:3000 it will rise error that Given URL is not allowed by the Application configuration.
so becarefull with your website url you have specified in facebook app.
and the url you are running locally both should match
thank you
In my case, the problem was happening because I didn't configure the site domain in the right way.
You can access your site model by the admin and change the domain name from example.com to the real domain that you are using.
The best way to fix this is create a fixture; something like:
YOUR_APP/initial_data.json:
[{"pk": 1, "model": "sites.site", "fields":
{"domain": "127.0.0.1:8000", "name": "127.0.0.1:8000"}
}]
Make sure your domain is not being masked.
The base_url must contain the Site URL or Canvas URL as defined in your App Settings. I always get this error when I set a redirect_url that doesn't contain the URLs in App Settings.
You do have to register/create the url with facebook, by creating a facebook app. You might have to give the mobile phone number to them. The Site url you put in there needs to passed as the redirect url.
rails#{This error is related to URL}
-I just put the ip address in all the URL instead of localhost..now it's working file before doing that I tried so many things but didn't work..I am sure this one will work..

Tab Page Error: The requested method GET is not allowed

I have just set up a custom tab on my page for the first time. I have thoroughly followed the setup guide and seem to have everything on the Facebook side setup correctly.
However when I view my page it throws the following error:
Method Not Allowed The requested method GET is not allowed for the
URL /Facebook/index.html. Additionally, a 404 Not Found error was
encountered while trying to use an ErrorDocument to handle the
request. Apache/1.3.41 Server at feebnaturals.com.au Port 80
I believe it may be some kind of Apache server config issue, however I'm not that Apache savvy, so not sure where to start.
I had the same problem, but instead of GET, it was POST method which was not allowed. This is a setting on your server. Not server savvy myself, but it seems that my provider didn't allow this method on html-page, but makes no problem on doing the same for php-pages. So all I did was rename my page from .html to .php, updated the app settings in facebook and all works fine now.
This is definitely an error on your side, check your server logs and see what they say - it looks like you've configured the page to only work via a POST request and it's being requested in a GET request