Reputation: 1199
Why does it always happen to me?
This happens after my application verify for user user login and redirect user to the authentication page:
https://www.facebook.com/dialog/oauth?client_id=XXX&redirect_uri=http%3A%2F%2Fexample.com%2Fmyappname%2F&state=YYYYYY&scope=offline_access%2Cpublish_actions
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.
Upvotes: 50
Views: 134321
Reputation: 41884
Answer for 2015
Sandbox mode is gone.
Proceed to 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?
Upvotes: 1
Reputation: 35
Check your appid and make sure you have updated your Site URL Mobile Site URL in https://developers.facebook.com/
Upvotes: 0
Reputation: 2136
I faced the same problem and reason was that my app was not live
and publicly available.
I added my email id in contact email under setting tabs and make my app live(which previously was disabled to make live).
After making my app live its showing sharing dialogue with proper image, title and description with my app name in bottom.
Upvotes: 0
Reputation: 2600
Settings > advanced > security > valid oauth redirect URI
Upvotes: 0
Reputation: 2514
I know u may got the answer but this is for those who are still going down the thread for getting the solution.
U can try all the above solutions but just remember that delete the Previous app from the device or simulator before checking another solution.
I tried all solutions but getting no response as i was not deleting the previous app, only cleaning the build does not satisfy the condition.Hope it helps someone. :)
Upvotes: 0
Reputation: 17339
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.
Upvotes: 0
Reputation: 1482
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.
Upvotes: 7
Reputation: 1
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.
Upvotes: 0
Reputation: 745
I had the same problem, and fix it by adding param &display=touch to url
try, it may helps
Upvotes: 1
Reputation: 327
If your all code is working properly then to remove such type of error go to Facebook Developers Apps and disable sandbox mode.
Upvotes: 2
Reputation: 8568
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);
Upvotes: 2
Reputation: 441
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.
Upvotes: 1
Reputation: 51
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.
Upvotes: 5
Reputation: 21
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..."
Upvotes: 2
Reputation: 267077
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)
Upvotes: 0
Reputation: 170
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.
Upvotes: 0
Reputation: 3087
Solution for me is to set option 'Authenticated Referrals' to enabled. Its realy fixed after that.
Upvotes: 3
Reputation: 11741
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.
Cheers!
Upvotes: 2
Reputation: 171
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.
Upvotes: 1
Reputation: 12257
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.
Upvotes: 0
Reputation: 11
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:
Save and wait a couple of minutes for the information to propagate, although it worked right away for me.
Upvotes: 1
Reputation: 1212
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 :-)
Upvotes: 3
Reputation: 1505
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.
Upvotes: 0
Reputation: 111
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.
Upvotes: 3
Reputation:
I had this error because I was using redirect_url
as a parameter instead of redirect_uri
.
The Server-Side Authentication doc page says to use redirect_url
:
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
Upvotes: 0
Reputation: 21
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.
Upvotes: 2
Reputation: 178
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 http://mysite.com
worst. subdomain. ever. :u)
Upvotes: 7
Reputation: 658
I have had the same problem as you.
From the Facebook Developers Apps page, make sure that the Sandbox Mode is disabled.
Upvotes: 64
Reputation: 680
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',
));
Upvotes: 5