Why does it always happen to me?
This happens after my application verify for user user login and redirect user to the authentication page:
But instead of showing the authorization page, Facebook shows an error page with
An error occurred. Please try again later.
Is there any configuration I have to do before try to authenticate my users?
All is done with PHP using the PHP-SDK classes.
I had the same problem after changing the domain of my site. Altough I properly changed the request_uri parameter and updated my app settings with the new domain, the error kept showing up.
Then I realized that the ID and the SECRET ID of my Facebook APP had automatically changed with no warning!! The whole thing started working again using the new ID.
I have had the same problem as you.
From the Facebook Developers Apps page, make sure that the Sandbox Mode is disabled.
This was happening to me also but all the api keys, secrets and stuff were correct. What I found is that my app was running in sandbox mode. Go to your app settings in https://developers.facebook.com/ click the advanced settings tab and check to see if your app is in sandbox mode. If it is disable it and try again. Let us know if it works.
I was getting this error because I was starting from
http://mysite.com, but had specified
http://WWW.mysite.com in my Facebook settings – the www mattered… I ended up solving by using .httpaccess to always kill the “www”, and pointing FB to
worst. subdomain. ever. :u)
When working with Dialogues, Facebook provide a ‘show_error’ attribute that defaults to
no but can be set to
true in a Development environment and is really helpful for debugging purposes.
show_error – If this is set to true, the error code and error description will be displayed in the event of an error.
Instructions of it’s use can be found in the Facebook Docs.
I’d been debugging “An Error occurred. Please try later.” dialogue before i found this attribute in the docs. Once i started using it, i could see the following message too:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
I had the same problem; it turned out FB requires a string appID and not an int…
//DOESNT WORK: $facebook = new Facebook(array( 'appId' => 147XXXXXXXXXXX, 'secret' => 'XXXXXXXXXXXXXX', )); // WORKS: $facebook = new Facebook(array( 'appId' => '147XXXXXXXXXXX', 'secret' => 'XXXXXXXXXXXXXX', ));
For me this happened because the “test user” I created was part of a separate app. I created a test user for THIS app, and it started working fine.
Stupid on my part I know, but this could save someone else some trouble.
Make sure your app is configured to use the appropriate URL & domain of your site. That may be it.
According to OAUTH Dialog documentation:
*redirect_uri: The URL to redirect to after the user clicks a button in the dialog. The URL you specify must be a URL of with the same Base Domain as specified in your app’s settings, a Canvas URL of the form https://apps.facebook.com/YOUR_APP_NAMESPACE …*
I am constructing oauth links dynamically to ask a user for additional permissions if needed and I realized, that even if you are redirecting to https://apps.facebook.com/YOUR_APP_NAMESPACE you have to have the App Domain and Website settings set in your application administration. I set domain to facebook.com and Website to facebooks root url.
Now my oauth dialog link works fine – even in sandbox mode.
I had this exact problem on a Page Tab app and for the life of me couldn’t work out what the problem was. It worked on my test page but as soon as I made it live it wouldn’t work. I found in the end that I fixed the problem by putting the actual URL to the Page Tab (i.e.
http://www.facebook.com/<"page_name">/app_<"app_id">) into “Site URL” under “Website”. This doesn’t make any sense. But it worked 🙂
Solution for me is to set option ‘Authenticated Referrals’ to enabled. Its realy fixed after that.
The issue resolved after I updated the ‘appID’ and ‘secret’ and then pushed the change back to heroku (i.e. – ‘git push heroku master’)
The key is not to forget to push the changes back to heroku master. Very easy to overlook if you’re use to testing on localhost.
Hope this helps.
For me the problem was that the Facebook users I was using to test the app did not have its email address confirmed by Facebook.
My client had set up 2 fake accounts on Facebook and told me that they were not working. But he forgot to confirm the email addresses of those accounts (the emails Facebook sent went to his spam folder and he didn’t notice).
Took me hours to find this, so I hope it helps somebody.
Also had a problem with wrong redirect link: I had a link starting with “https://apps.facebook.com?myapplication”…. but after authorization the redirection would bring me to “apps.facebook.com/Myapplication” and consequently I would get a message described above:”Error occured. Try back later.” since “apps.facebook.com”… means “http://apps.facebook.com/Myapp” and not “HTTPS://apps.facebook.com/,…”
The solution: went to my application settings in facebook developers section. Clicked ‘Edit’. In the left-side Menu selected “Permissions” (by default the Menu is set to Basic) and in the newly opened set of setting changed my “Auth Token Parameter” from “Query string” to “URL Fragment”.
It worked! After authorization is finished the users are taken to “https://apps.facebook.com/myapp…”
Another possible mistake, if you directly copied the code from Facebook SDK example then you may get the same error despite of having everything correct. http://developers.facebook.com/docs/reference/php/
This is because in their example they have used backquotes instead of single quotes for the key of the array. The correct code is as follows.
require_once("facebook.php"); $config = array(); $config['appId'] = 'YOUR_APP_ID'; $config['secret'] = 'YOUR_APP_SECRET'; $config['fileUpload'] = false; // optional $facebook = new Facebook($config);
If your all code is working properly then to remove such type of error go to Facebook Developers Apps and disable sandbox mode.
I just encountered this problem myself. I’m developing an app internally, so my host is ‘localhost’. It wasn’t obvious how to set ‘localhost’ up in the app configuration. If you want to develop locally, set up your app by following these steps:
- Go to the place where you manage your Facebook app. Specifically, you want to be in “Basic” under the “Settings” menu.
- Add ‘localhost’ to “App Domain”.
- Under “Select how your app integrates with Facebook”, select “Website”, and enter “http://localhost/”.
Save and wait a couple of minutes for the information to propagate, although it worked right away for me.
I had put the restriction on the app that only United States residence could use the app. I was working from Canada at the time this error message appeared. After removing the restriction everything worked.
Came here with a similar problem and, yes, my Sandbox was enabled. I disabled it and, voila, the login problem went away. I must warn that this problem does not affect developers and website administrators as Facebook allows those users to see the app. For this reason, I couldn’t even believe that users complained about not being able to login, as I was able to login with no problems at all.
I had the same problem, and fix it by adding param &display=touch to url
try, it may helps
Answer for 2015
Sandbox mode is gone.
My Apps -> Your App -> Status & Review and change the slider to yes for:
Do you want to make this app and all its live features available to the general public?
If you’re the app developer, you may see a more specific error message, but generally that message means one of two things:
- Your server returned a HTTP error code (usually 5xx)
- You tried to send the user, after login, to a URL not allowed by your app configuration (though as an Admin of the app, you should see a more specific error message and Facebook error code in this case)
I had this error because I was using
redirect_url as a parameter instead of
The Server-Side Authentication doc page says to use
https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID &redirect_url=YOUR_REDIRECT_URI &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES &state=SOME_ARBITRARY_BUT_UNIQUE_STRING
But this is incorrect. The OAuth Dialog doc says to use
redirect_uri instead, which works, so I’m assuming that you can only use one and not the other:
https://www.facebook.com/dialog/oauth/? client_id=YOUR_APP_ID &redirect_uri=YOUR_REDIRECT_URL &state=YOUR_STATE_VALUE &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES
I had tried all the answers mentioned here. But it didn’t work. I had to delete and create again. I am guessing it was due to new the “Authenticated Referral”. If you have added Open Graph objects which are not approved, it might give you an error.
I had the same problem and the root cause was different:
I was logged in as a Test User of a different application. Therefore I wasn’t able to authorize an app that’s not the one where the Test User was created for.
When I logged out and logged in as a regular user or a Test User for the app I tried to authorize, everything was OK.
In my case, there was an age issue with the account being used with the app.
If the FB app has alcoholic content then FB users who are younger than about 21 will throw an error when trying to authorize with it.
You need to specify
http:// in your REDIRECT URI.
For me the issue was that the url of the app didn’t completely match the url I was running it on (i.e different directories, same domain)
There is no possibility to solve this type of error. So Its better to use your custom dialog same like shown in facebook and post message again & again without login. Even though you remove your app from facebook, you can ask for login and post message successfully.
The reason in my case was completely different. I was trying to open a Feed dialog automatically after page load. And 9 times of 10 it displayed this error. First, I added
show_error: true parameter as suggested by @Peter Roome, but it didn’t help, displaying
104: Invalid signature, not descriptive at all.
Then I figured out the reason. The code was in
$(document).ready jQuery function. And it seems that some facebook stuff had not yet been loaded at the point the code was to be executed. I moved the code to
$(window).load block (which is executed after all page content is loaded), and the problem has been solved.