Inconsistent results for Facebook redirect to HTTPS - facebook

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!

Related

URL Blocked: This redirect failed because the redirect URI is not whitelisted....(Localhost web application)

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.
I've installed the laravel/socialite and I'm trying to link my application with facebook ! after installing the package ,creating my facebook application , I try to acces to the login page with facebook on my application but it keeps telling me that ther's some kind of URL errors ... ??? any ideas.?
I faced this issue as well. What I did:
When you get this message, copy the URL from the browser window, and inspect it. The URL has the redirect URL mentioned within it. Copy the exact redirect URL as mentioned, and put it under Valid OAuth Redirect URLs, it will solve the problem.
It's redirect URL problem. Facebook automatically generates a redirect URL which is http://...[your domain]..../signin-facebook. You need to add this URL to Client OAuth Settings along with your own redirect_URL like below:
Hope it helps
I've just had the issue (Nov 2017), after years of it working (but did I change something inadvertently?).
The fix was to add the callback url in the "Facebook Login" "Products" (in the left menu, in the Facebook admin console, NOT in the "Advanced settings" where I've tried everything:
https://developers.facebook.com/apps/{{your FB app id}}/fb-login/settings/
Note that you need to put the port number if you have one, e.g. in my case http://local.dishly.menu:3000/
I had an issue with this, specifically with heroku.
My test site was not https. It was http. And by default, facebook likes to prepend a url with https if you don't manually type it in when typing in the url.
So, I added two urls. one with http, and one with https. works fine now \o/
I had this issue because I was using Ajax to login and signup for my site, so I added this redirect url
https://yoursite.com/wp-admin/admin-ajax.php?action=gears_fb_connect&callback=true
and it worked perfectly any user can sign in with his facebook account.
I'll post it here just in case it's useful to someone in the future because I got in this question looking for answer...
In my case I got this error while trying to integrate Facebook as an Identity provider in conjunction with Azure AD B2C custom policies.
Microsoft docs mentions a given URL in this format:
https://your-tenant-name.b2clogin.com/your-tenant-name.onmicrosoft.com/oauth2/authresp
however when clicking the Facebook login button it was redirecting with the tenant Id instead of the Tenant Name like this:
https://your-tenant-name.b2clogin.com/TENANTIDHERE/oauth2/authresp
This was causing the URL to be blocked by Facebook.
I discovered this by reading this answer right here.
If you need to decode the URL that it's redirecting to, you can use this:
https://www.urldecoder.org/
There is only one valid answer to this question, go and analyse url that shows the URL not accepted facebook page. The url that you need to put into "Valid OAuth redirect URIs" is available there.
In my case it was :
https:// facebook /v3.2/dialog/oauth?client_id=4423058&redirect_uri=https://{The Web Site Name} /complete/facebook/&state=VnZlfU3hp&return_scopes=true&scope=email
The answer in my case :
https://{The Web Site Name}/complete/facebook/
I was having this same issue, but my error was that I was not properly encoding the return uri in the Facebook oauth query string.
So, if your return uri is something like this
https://www.example.com/social-signin?provider=facebook
Don't forget to (URL) encode it like this:
https%3A%2F%2Fwww.example.com%2Fsocial-signin%3Fprovider%3Dfacebook
The final Facebook oauth uri should look like this:
https://www.facebook.com/v4.0/dialog/oauth?client_id=YOUR_CLIENT_ID&scope=email&auth_type=rerequest&response_type=token&display=popup&redirect_uri=https%3A%2F%2Fwww.example.com%2Fsocial-signin%3Fprovider%3Dfacebook
In my case, having an issue with the HTTPS protocol. Must use your domain or localhost server with
HTTPS Protocol,
Old localhost url: http://127.0.0.1:8000/
New localhost url: https://127.0.0.1:8000/
Put URLs in Valid OAuth Redirect URIs in Facebook Login Settings,
https://127.0.0.1:8000/social-auth/login/facebook/
https://127.0.0.1:8000/social-auth/complete/facebook/

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.

Facebook App - Server not found error

I have created a facebook app and url is https://apps.facebook.com/wishisdone/?fb_source=bookmark_favorites. When I view the app it says server not found. My website's url is http://wishisdone.visionswebsites.com/wishisdone/login.aspx.
But facebook app is redirecting to www.wishisdone.visionswebsites.com It should open without www but there is no app setting in the facebook to include or exclude www. I entered the correct url "http://wishisdone.visionswebsites.com/wishisdone/login.aspx" in the site url
Please help me. How can I make it working.

Facebook OAuth Login: Invalid site URL and Invalid app domain

My app's domain is thehub.j.layershift.co.uk
In the "App Domains' box, I'm attempting to put: thehub.j.layershift.co.uk
I also have selected Website with Facebook Login and in the Site URL box, I'm trying to put: http://thehub.j.layershift.co.uk/login
Everything works fine with "localhost:8080", while I was testing. What are these domains invalid?
EDIT:
Tried again, still not working. Surely this can't be this difficult???
EDIT AGAIN:
Screenshot: http://i.imgur.com/rGkrZn4.png?1
FINAL EDIT:
Turns out this was an issue was Facebook. After speaking with a support dude over there, he fixed it in about .5seconds. Thanks for the help!
Try the following (worked for me):
In the app domain put layershift.co.uk
In the app URL put http://thehub.j.layershift.co.uk
thehub.j.layershift.co.uk is not a domain - it is a URL. You should try placing only the domain in the domain field.
That would be -
layershift.co.uk
The other parts of the URL (thehub.j) are subdomains of layershift.co.uk.
One more thing that you might want to take a look at is the fact that the URL http://layershift.co.uk is actually being redirected to http://layershift.com. Facebook is not able to retrieve data from that URL while it is being redirected.
With regard to the Site URL, what you'll want to put there is the landing page of your site/application. When you set the Site URL to /login, anyone reaching your application (logged in or not) will be directed to the /login page.

Facebook : Given URL is not allowed by the Application configuration

What is wrong here? If a user clicks on the login button he is redirected to http://www.facebook.com/plugins/login.php?action=like&api_key=211295588901671&channel=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D3%23cb%3Df207fe8ecd56db2%26origin%3Dhttp%253A%252F%252F188.24.5.134%252Ff3dedfc22a9c9ac%26relation%3Dparent.parent%26transport%3Dflash&locale=en_US&login_text=&max_rows=1&sdk=joey&show_faces=true&width=200 which gets me to the facebook error Given URL is not allowed by the Application configuration.
I believe it's because the URL the request is made from is not under your Site URL.
Look at your "origin" parameter in the URL you've submitted.
You can only make calls from the location you've defined as your Site URL.
I have used login url in following format
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream
as per documented in http://developers.facebook.com/docs/authentication/ and it works. I get back request on my web page url provided in application config as mentioned. http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER
Facebook needs a domain to work properly, so you'll have to register a domain instead of using just your IP. After that, it should work.
Also, post the code you're using, there might be some errors in there too.
Try going to App Settings > Advanced & enable things ending with "Client OAuth Login"; worked here :)