Facebook API - Fatal error: Uncaught OAuthException - facebook

I created a Facebook application, and I get this error:
Fatal error: Uncaught OAuthException: Invalid OAuth access token signature. thrown in /var/www/customers/vh-394/web/home/dev.a-soft.hu/ssl/api/facebook/xzona/sdk/src/base_facebook.php on line 1106
I'm new with developing Facebook applications and have lost the "App domain", "Site URL", "Canvas URL", "Secure Canvas URL" settings.
Probably there are some URL-settings error, but I don't know exactly how secure URLs work, and how Facebook authentication works.
Can anyone please help me about how to set these URLs above and how I can correct this error?
Thanks
EDIT:
There is a game I'd like to integrate into Facebook, so FB users can play with it, share points, etc. You can find this game here:
https://ssl.a-soft.hu/api/facebook/xzona/_index.php
If you look at this page, you can see me and some of my FB friends, but it's not real, I just learned how FB stores data in arrays so I generated them. In this file there is no connect to FB, or any FB scripts.
The real file is index.php, where everything happens. Some months ago I started to create this app using Heroku, but then I bought real ssl domain.
Anyway, the way that my app tries to connect with FB, authenticating it, is the way that Heroku uses.
So it includes "AppInfo.php", "utils.php", "FB sdk" (as Heroku), but I don't know if I failed something to use correctly.
On FB dev page, I didn't fill "App Domains" field, and under "Select how your app integrates with Facebook", I checked only "App on Facebook". In there I filled the fields exactly like this:
Canvas URL: https://ssl.a-soft.hu/api/facebook/xzona/
Secure Canvas URL: (same)
Canvas Page: apps.facebook.com/xzonahu
And now I still have the same error:
Fatal error: Uncaught OAuthException: Invalid OAuth access token signature. thrown in /var/www/customers/vh-394/web/home/dev.a-soft.hu/ssl/api/facebook/xzona/sdk/src/base_facebook.php on line 1106
Hope you can help! :)

Which URLs you need depend on exactly what kind of app you're making. Assuming you are making an app that you want embedded in the facebook frame, you should make sure that only the "App on Facebook" box is checked under "Select how your app integrates with Facebook"
You need the following URLs:
Hosting URL: This is the url where all of your resources are stored.
Canvas URL: This is the url of the page that should be displayed within the Facebook frame.
Secure Canvas URL: Secure version of the Canvas URL (making both canvas urls the same https url worked for me)
Canvas Page: This is the facebook page people visit to see your app ie. http://apps.facebook.com/myapp
All that said, there are all sorts of things that can go wrong with OAuth so if that doesn't solve the error message come back and we'll see what else it might be.

Related

Facebook - Wordpress App Error Facebook returned an error: The site URL in your Facebook application settings does not match your wordpress blog URL

I have a wordpress blog and am trying to integrate the facebook page publish version 2 app and keep getting 2 errors, one of WP:
Facebook returned an error: The site URL in your Facebook application settings does not match your wordpress blog URL
And on FB app creator when putting in the app domain:
This must be derived from Canvas URL, Secure Canvas URL, Site URL, Mobile Site URL, Page Tab URL or Secure Page Tab URL. Check and correct the following domains: mywpsite.com
I have not used any http:// just the domain name.
I updated to v2 of facebook plugin, deleted the old version 1, made sure my domain name didn't have upper case, deleted the app in FB and started again and still I get this error.
When I put in the app id into wp plugin the grant access rights button stays grayed out as well, imagine that's because the app is still not set up correctly.
Any help on why I keep getting these errors would be very useful.
Thanks
Andrew
Click the '+Add Platform' box below and depending on the app you want to add, in this case I assume click 'Website', and then add the website's URL to Site URL. This will now allow you to save the URL properly.

Inconsistent results for Facebook redirect to HTTPS

My homepage redirects to the URL listed below to open an oauth dialogue with Facebook to validate user credentials.
<meta http-equiv="refresh" content="0;URL=http://www.facebook.com/dialog/oauth/?client_id=myclientid&redirect_uri=http://www.mywebsite.com/home/index.php" />
The Site URL (Website with Facebook login) in my Facebook App profile is
http://www.mywebsite.com
Everything works great for HTTP but when I recently implemented an SSL certificate I struggled to convert everything to HTTPS (changing HTTP to HTTPS in my redirect URLs and the Site URL in my Facebook app profile. I get the following Facebook error:
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.
I've fought with this a few hours at a time but was never successful and always just changed the redirect URL and the Site URL in my app profile back to HTTP. Last night it worked! I published the code and tested it successfully on two separate computers in both IE and Chrome. This morning I woke up to the same error code I was getting before.
Does anyone have any ideas why my Facebook oauth dialogue seems to be fickle when it comes to HTTPS?
Make sure that you have a valid base domain specified in your app settings.
This is a working example of a website with Facebook connect. At the top I have added a code to:
Detect if the user is authenticated yet and if not it will...
Detect if SSL is being used
If SSL is in use it will check to makes sure that whatever the
current page is (gets dynamically) contains the URL you enter in the
first variable ('$sslurl' in the top settings); otherwise, it will
default back to $sslurl and add whatever page you were visiting to
the end of it.
It will then use the correct url to authorize the user using the
generated SSL url as the redirect_uri
The rest of the script is just a generic website with facebook
connect setup
It's too long to place inside code tags so I put them in a text file here:
http://o-e.us/ssl-facebook-connect.txt
Hopefully it helps, Good luck!

Facebook denies access of my app

I have an app that shows the share popup.
I have encountered a problem when trying to get it working form a different server.
I get the following error:
Error An error occurred with myapp. Please try again later.
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.
How can I enable it to work from all servers? no matter if they are mine or not?
Any suggestions?
Thanks in advance.
Note:
I would like it to be via the JS SDK.
Facebook apps can only work with one main domain.
The main domain is derived from either the "Site url" or the "Mobile web url" as defined in the app settings page in the Developers application.
You can however add subdomains for that same domain.
For example, let's say your "Site url" is http://app.example.com, you can add more subdomains which you want to use with facebook by adding them to the "App Domains" field in the settings page (basic tab).
You can add subdomains like: http://sub1.example.com or http://example.com.
If you try to add a url that does not derive from that you should get the following error message when trying to save the settings:
Error
DOMAIN_YOU_ADDED must be derived from your Site URL or your Mobile Web
URL.
Edit
You have a problem if you want to use the FB.ui method.
The fb sdk will only accept usage from your own domain, and if you load an iframe from your own domain then the parent window (which is of another domain) won't be able to communicate with that iframe (same origin policy).
What you should be able to do is use the direct url of the feed dialog:
http://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.example.com/response
You can open that in a new window/tab, or if it's an action of a user click then even open a pop-up.
But you won't be able to use the iframe dialog of the sdk.

I want to open a facebook dialog in an iframe, instead of as a popup

The following code generates a link that when clicked will popup a facebook dialog, and once the user authenticates to facebook, they can share to their wall.
<a href="http://www.facebook.com/dialog/feed?app_id=<APP_ID>&message=<MESSAGE>&caption= <CAPTION>&link=<LINK>&display=popup&redirect_uri=<REDIRECT>" class="share-icon facebook popup" rel='Share via Facebook'></a>
I would like for the same dialog to be generated within my page using an iframe. I attempted to load it like this:
<iframe src="http://www.facebook.com/dialog/feed?app_id=<APP_ID>&message=<MESSAGE>&display=iframe&access_token=ACCESS_TOKEN&redirect_uri=<REDIRECT>&show_error=true&caption=<CAPTION>&link=<LINK>"/>
The popup works fine. But, when I try the Iframe, it loads the following error:
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.
Which of course seems wrong, because it's the same redirect_uri in both links.
The end result I want, is the share to be in page, and not be a popup. Any suggestions?
In the app settings (specifically Settings -> Basic -> Basic Info), is the domain of the redirect_uri specified in the "App Domain" field? In general, I get that error when I fail to do that.
(And as to why that might be happening, Facebook treats iframes much more strictly than new windows.)

API Error Code: 191

yep, getting the 191 error.
I've researched and found this question to be helpful:
Facebook API error 191
My URL looks like:
https://www.facebook.com/dialog/oauth?client_id=&redirect_uri=http%3a%2f%2flocalhost%2fFb.201109Birthday%2fOAuth2.aspx
However, I get an error:
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.
I've read everywhere that the urls must match up to what's listed in the application's setting page. I've got
App Domain = localhost
Canvas Url = http://localhost/Fb.201109Birthday/Birthday.aspx?
Secure Canvas Url = http://localhost/Fb.201109Birthday/Birthday.aspx?
I've also tried local.facebook-apps.com (replaced "localhost" everywhere above with "local.facebook-apps.com") with a hosts file entry to point to 127.0.0.1. But all of these scenarios still give the 191.
Remove the Birthday.aspx from the Canvas URLs.
I was also getting this error when i created a facebook application that was going to be installed onto a tab on a fan page. It turns out that when i first created my facebook application i only filled out the section for "Page Tab" but i didn't fill out the section for "App on Facebook".
i didn't fill out the App on Facebook section because i didn't want users trying to add the app from the app profile page. Anyway, it turns out that by not filling out the App on Facebook section and adding a canvas URL and secure canvas URL i was getting the Error: 191 when trying to make a javascript call to FB.Login().
Once i filled out the App on Facebook section the error went away.
Filling up the "App on Facebook" page, with Canvas url, ended with /
solvet it for me
ex: canvas url.
above issue can be removed via providing the URL for the web site or localhost you are working on, at https://developers.facebook.com/apps/ under Edit-->Website with Facebook Login
Web forwarding occurs 191 problem.
I used web forwarding for app's domain.
I had problem 191 and solved by fixing original url.