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

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/

Related

Cordova facebook OAuth login issue

I am trying to use facebook oauth in phonegap app http://coenraets.org/blog/2014/04/facebook-phonegap-cordova-without-plugin/
but the issue is my redirect url will be like "file:///" which doesn't seem to be working.
It opens the facebook blank window.
Am I missing anything?
You don't need to explicitly specify the redirect URL in the FBInit(). Just pass the FB App id. The default redirection url is https://www.facebook.com/connect/login_success.html. Add this in your redirection url in FB app Advanced settings.
Importantly make sure you add the inappbrowser core plugin:
cordova plugins add org.apache.cordova.inappbrowser
You should be good to go.
vou have to specify some dumy URL or localhost for redirect_uri and it will work.
Here is facebook oauth example for phonegap:
https://github.com/krisrak/jquery-cordova-oauth2
I also tried this library http://adodson.com/hello.js/#hellojs
, which allows you to specify your re-direct url.
It would be useful in case you have a server and want to know when a user login using your app.
It also seems that if your re-direct url is http://localhost/anything.html you do not even need to have it configured in Facebook. Feels like a bug.

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.

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!

OAuth facebook pagetab app error

I'm totally stuck on this one..
I cant get js sdk or even the oauth link working..
When I try the oauth example, it works just fine:
https://www.facebook.com/dialog/oauth?scope=email,user_birthday&client_id=123050457758183&redirect_uri=http://www.example.com/response/&response_type=token
but in my case:
https://www.facebook.com/dialog/oauth?scope=email,user_birthday&client_id=317872318261965&redirect_uri=http%3A%2F%2Fwww.facebook.com%2Fpages%2FDigiComm%2F185749568187479%3Fsk%3Dapp_317872318261965&response_type=token
the link is basically the same, but get's an error
I've been fighting with this for days.. And can't understand, what could be the problem,
because each time i try to open the auth dialog with js sdk i get this same error..
It must be an error in the app settings on facebook side, but i cant understand what..
I'd say i have the same problem as this guy..
but as i can see he hasnt gotten any answer too:
Using OAuth dialog for facebook app do not allow to use canvas URL as redirect_uri
You need to make sure that the canvas/tab/website URL's in the developer app (https://developers.facebook.com/apps/317872318261965) match the redirect URI in your url.
At the moment, your link is pointing to http://www.example.com - you need to point this to wherever your app is hosted.
try to add http://www.example.com/ with all the slashes as website and example.com as app domain
Update:
If it is a canvas app your redirect_uri should be:
urlencode("http://apps.facebook.com/MY_APP_NAMESPACE/");

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 :)