Facebook access token graph API call result in a bad request error - facebook

We have a Canvas Facebook App and for some time we get a strange error for some of the users that are trying to install (allow) our Facebook app. I mention this is happening only for some of the users and not for all! The error we are getting is "The remote server returned an error: (400) Bad Request." The graph API call we putted in a try catch block and this is what the logs says when I searched over them to see what went wrong. The graph API call is:
https://graph.facebook.com/oauth/access_token?client_id=XXX&redirect_uri=XXX&client_secret=XXX&code=code_received_from_facebook.
We received the code from Facebook and append it to the graph API call from above but it seems that for some users this is not working. Our redirect_uri parameters contains an URL to our Facebook App and contains also some parameters (example: http://apps.facebook.com/our_application_URL?cid=xxx&surveyid=xxx&messageid=xxx).
xxx = some values.
Did some of you confront with this kind of strange behavior? Working for some users but for other is not working? We are using the same code so nothing change between a successful installation and a unsuccessful installation.
Thank you for your help in advance!

Now that Facebook require SSL for applications your "redirect_uri" need to be https (i.e https://apps.facebook.com/myapp/), otherwhise you will get "Bad Request".
You probably got the error for only the users that had forced SSL but not the rest.

Related

Facebook error code: 4 | message: Application request limit reached

I got the error "Application request limit reached" 2 days back. So I have removed all the extra API calls from my website and added just two calls.
Get user details after successfully login using Facebook credential and get access token.
Using User access token fetch all the pages of user.
After removing extra API calls I have checked my websites after 48hours but when I tried to login using Facebook credential and trying to fetch user's pages, It throws "Application request limit reached" Error.
Can anyone please help me to solve this issue?
Thanks.

Botpress can't connect to messenger

I am making my first bot on botpress. On trying to connect botpress with messenger by inputing app id, app secret and access token through UI, I am getting forllowing errors :
An error has been returned by Facebook API. Status: 400 (Bad Request) (#100) callback_url should represent a valid URL.
Even when manually input these values in botpress-messenger.config.yml same error is shown.
but the fallback url gets validated on messenger developer console.
What am I doing wrong?
Try checking if your domain is existing. Also, remove https

receiving exception when hitting facebook graph URL for oauth request

I am trying to figure out the best possible way for me to debug/verify facebook graph URL's (I am trying to specify permissions in the URL for oauth) e.g.:
https://graph.facebook.com/me?fields=name,picture,email,likes,interests,gender,id,locale,friends,first_name,last_name,link,user_about_me,friends_about_me&access_token=%s
However, I keep receiving an error message mentioning socialauth did not work correctly (I am using scribe/Java in debug mode). I could not locate other error messages. I am able to run oauth correctly with scribe using a smaller URL & I am not sure whether the issue is with the permissions I am asking for or the string I am creating. Any insights on how to troubleshoot or fix the issue will be appreciated. For any downvoters, seek a life!
Edit:
I am using scribe-java for oauth as mentioned in the post. I tried the URL above (as I mentioned in the post) but it gave me an exception in scribe (I used debug mode for scribe but I did not see any error messages besides "social auth did not work correctly"). When I try the same URL but without "user_about_me,friends_about_me" in the URL, I get a response from Facebook with a successful oauth. Are the values "user_about_me,friends_about_me" invalid for the oauth URL or perhaps I need to dig deeper into how scribe is communicating this to FB? I would not be surprised if its something I am doing which is incorrect - I just need to understand how best to troubleshoot this.

Facebook Login - dialog/oauth giving error

When I try to access my Facebook app without being logged into Facebook, I'm getting an error. If I'm already logged into Facebook, I get directed to the application normally, but without being logged in
Using the example for server-side CSRF on this page, my site generates a "state" variable to store in the session and redirects the user to the following URL:
http://www.facebook.com/dialog/oauth?client_id=[APP_ID]&redirect_uri=[APP_URL]&state=[RANDOM_NUMBER]
All I'm getting by way of an error message is
Error
An error occurred. Please try later.
With no clear indication what's gone wrong, where, or why.
The app is running on a live server, with the domain name and path matching what's specified in the Facebook app control panel.
If your receiving the Error 'An error occurred. Please try later.' on the Facebook login page then i would suggest you to verify the value for the parameter 'redirect_uri'. the value supplied in the above url should match with the one set for the facebook app in the spp settings page.
Had faced a similar problem during my initial days. Hope this helps.

"OAuthException","message":"Error validating application."

up until 4 days ago this was working just fine, now I keep receiving an error when trying to post a youtube video on my friends (or even my own) wall.
Reading user ids from list.txt and send them a video
Posting video to user id: me
{"error":{"type":"OAuthException","message":"Error validating application."}}
I am getting the same error with an application which i created on a friends facebook account when trying to do the same thing.
Does anyone have an idea why this is and what I can do to fix it?
Thank you!
I started getting this problem for some of my users on my app recently. It was because my database field for storing oauth tokens was limited to 100 characters, which in the past has been long enough for facebook oauth tokens. Newer tokens are sometimes longer than that.
Just a guess...
I have suddenly started getting this on working code too. I have traced the API URL the PHP SDK is calling and it does have an access token in. The PHP SDK errors with 'An active access token must be used...' and calling the URL it called manually results in 'Error validating application.'