I've scoured SO and googed all over the place, and I'm still stuck. I feel a little ridiculous, but I've been banging my head against this wall for a few hours.
Here are my FB app settings:
App Domain: name.local
Site URL: http://name.local:4000
I'm running a local web server and have a web application up and running.
Authentication works (which seems odd because my redirect_url is the same in both the authentication URL and the dialog/feed URL)
name.local is in my /etc/hosts file and points to 127.0.0.1.
I'm running on port 4000.
This URL doesn't work:
https://www.facebook.com/dialog/feed?client_id=nnnnnn&redirect_uri=http%3A%2F%2Fname.local%3A4000&name=aname&caption=acaption&description=descr&show_error=true
I get this error message:
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'm using test users (created using the FB test user API).
I've checked that my Site URL and redirect URL are in unison about a million times.
Any idea what I'm doing wrong?
Site url and app url must be shame .
app url should not contain protocol information .
site url should contain protocol
I love computers, they do exactly what you tell them to :)
I had to use app_id instead of client_id (that's what I get for copying and pasting from my authorization code).
Related
I have problem like here Facebook login message: "URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings."
I have checked various answers - cant make it work, and they don't give much new - just practically say to add url to that field.
One of them said to "Make sure your App IDs and Secret Keys are correct."
I found out they were not set, but now admin said he added those so should be ok.
What else to do? How to debug?
"URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs."
It also tells to check Client and Web OAuth to make on, but I have them off to increase security becasue I have read or watched somewhere in facebook documentation. And since login works locally with them turned off, they should be not be needed. I tested by trying to turn them on, but as I expected they don't fix the problem.
Update:
Redirect uri parameter is redirect_uri=https%3A%2F%2Falpha.vop.veracityinsurance.com%2Fconnect%2Ffacebook%2Fcheck
Made a video: https://www.loom.com/share/88e607aece6b45489214d95ee01bbb0b
I have made debug function and pushed it to server which prints provider:
$provider = (array)$this->clientRegistry->getClient('facebook_main')->getOAuth2Provider();
print_r($provider);
And from that class I see app id is correct in server.
config.yml
knpu_oauth2_client:
clients:
# the key "facebook_main" can be anything, it
# will create a service: "knpu.oauth2.client.facebook_main"
facebook_main:
# this will be one of the supported types
type: facebook
client_id: '%env(CONFIG__OAUTH__FACEBOOK__ID)%'
client_secret: '%env(CONFIG__OAUTH__FACEBOOK__SECRET)%'
# the route that you're redirected to after
redirect_route: connect_facebook_check
redirect_params: {}
graph_api_version: v5.0
Btw I am using symfony bundle for integration https://github.com/knpuniversity/oauth2-client-bundle
Made it work as 04FS said to turn on settings. It was enought to turn on one of them only - Web OAuth Login.
I have a web app that runs on localhost or example.com. And I am loading the facebook apps sdk to be able to do Single Sign-On, but I have this error in the console:
XMLHttpRequest cannot load https://www.facebook.com/impression.php. No 'Access-Control-
Allow-Origin' header is present on the requested resource. Origin
'http://example.com' is therefore not allowed access.
whereas I have gone in the settings of the facebook app and enter http://localhost/ or http://example.com/ in the Site URL field.
Here's the screen capture of my local url for instance :
...and the corresponding setting my facebook app account :
I really need some help here please !
Url given in SITE URL field must be match with your WEB URL [where facebook sdk invoked.]
Hence in your case, SITE URL field given : www.example.com
Web App URL must be : www.example.com
I'm running it locally under IIS Express using
http://localhost:XXXXX/
where XXXXX is the port number the website is running on and that works for me.
I'm developing a website that is going to use Facebook authentication.
I'm using GWT and it works fine when I run the code compiled, but when I'm running the development it does not work.
The problem is when I'm trying to retrieve the access_token from Facebook.
I'm receiving the error below:
"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request","type":"OAuthException","code":100}"
Obviously, the redirect_uri is identical as the login url one.
I found out (by this topic) that the problem is the last part of the url "?gwt.codesvr=127.0.0.1:9997".
How can I solve this? or how can I manage to use the GWT development mode with this problem?
Thanks,
Normally this is due to the url verification FB does.
When you register a new app in FB you have to configure the set of domains (App Domains) authorized to use the FB login form.
Unfortunately you cannot set 127.0.0.1 nor localhost as a valid domain, so you cannot use GWT dev-mode unless you configure a hostname in your domain pointing to your localhost.
If you set mydomain.com as a valid App Domain in your FB application, configure localhost.mydomain.com pointing to 127.0.0.1 in your local hosts file or in your DNS server. Then use http://localhost.mydomain.com:8888/myapp.html?gwt.codesvr=localhost.mydomain.com:9997 to run dev mode in your browser.
I found out the problem.
By encoding only the gwt.codesvr value it works.
However, using php urlencode function on it did not work, I had to encode it myself.
The gwt dev param ended like this "?gwt.codesvr=127.0.0.1%3A9997"
I am geting function.file-get-contents failed to open when i try to connect with server , my server fails to connect ,same application work in all server but in my server i am getting this error , Any solution , is that server CONFIG Issue ..
YOU CAN CHECK SERVER Config here http://gomandi.com/phpinfo.php
In the last few days I saw a few complaints about file_get_contents not working well when trying to access facebook api using it.
Take a look at these threads:
Getting 404 Error from Facebook Graph API
Facebook Auth with high traffic sites: empty access tokens, empty /me
Facebook API 400 Bad Request
You might find out what's wrong there. I suggest that you try to use something other than file_get_contents, such as curl, which was suggested in those threads as well (along side some code snippets)
I used to be able to, but for some reason all my Facebook Javascript API calls using FB.ui() no longer work in my development environment where my url is localhost:8080. In production it works fine though. I have a dev environment Facebook application, but I did just change URLs around in it. I assume that's where the problem is. How do I have a Facebook application that allows FB.ui() calls from dev and production environments? This is the error I get when calling FB.UI() in dev:
An error occurred with AppleTree dev. 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.
I always add a entry in my hosts file for something like:
127.0.0.1 dev.mydomain.com
And then set my app domain in the app settings to mydomain.com (to allow subdomains). Then access your site in your browser at http://dev.mydomain.com:8080 and FB.ui should allow the call.