facebook Error App Domain: [IP Address] is not a valid domain.? - facebook

I give my production server IP address as App domain in facebook application but it's not saved. It returns error as App domain is not valid. So that I cannot use my facebook connect API.
Can we give IP address as App domain in FB application? If it's not, what is the other way to do?

No, it looks like the app domain can only be a domain and not an ip address.
For example in the app settings page, near the App Domain hover the '?' and see:
Enable auth on domains and subdomain(s)
Also, I found this page: http://developers.facebook.com/docs/appproperties/ it refers to the REST api and so it's not that up to date, but it clearly states there that there are two different properties: base_domain(s) and ip_list.
I suggest that you try to put a normal domain and see what happens.

All Wrong answers. Here is the true
You must click (+ add platform)
then Select Platform choose app I select website the planet icon
Enter
Site URL http://www.yoursitehere.com
Mobile Site URL http://www.yoursitehere.com
go back and enter in App Domains: yoursitehere.com
now click save
go to Status and Review
Do you want to make this app and all its live features available to the general public?
change or move to (YES)

This is what I found works.
From the Facebook development page "Apps-YourAppName", click on Basic in the LEFT Nav.
There are 3 sections on this page: Basic Info, Cloud Services, and "Select how your app integrates with Facebook"
In the Select how your app integrates with Facebook section, select "Website"
Enter your fully qualified domain name in the Site URL dialog box. Example: http://www.mydomain.com OR http://mydomain.com (my site does not include the www so I didn't add it).
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
Now, in the Basic Information section at the top of this screen, you can now add your App Domain. This should be formatted as mydomain.com. Do not add "http://" and do not add "/" at the end of the domain name.
NOTE: My site does not use the www, so I cannot confirm that it's required in Step #6. Try it both ways if you're unsure.
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
At this point the error was NOT displayed as it was before.
Hope this helps!

One solution to getting over the problem of using an IP address as a valid domain is to use: xip.io
xip.io is a magic domain name that provides wildcard DNS
for any IP address
Simply add .xip.io after your url and use this as the domain name. Perfect for me as I do my development on a virtual machine!

If you don't have a domain (only the IP) just leave the "App Domains" field in blank. It works! =)
This, IMHO, is Facebook's fault as the error message is really confusing and makes you think only domains are allowed.
Hope it helps someone! =)

Related

Facebook App : This must be derived from Canvas URL, Secure Canvas URL

Hi I wan't to create a facebook app to use it for the auth in my new site locally installed(my machine),but from yesterday I don't succeed to install it and use it, all time I have this very strange error when I wan't write a domain in the "App Domains" :
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
the domain of my application is http://localhost/project/app_dev.php/ it dosn't work I change it by a real url such as : http://www.exemple.com/,but I had the same error,and just I notice that I see this error when I create an app with new look of facebook (yesterday)...
In my case the problem was I hadn't completed the "+ Add Platform > Website" section. Once I did that the contents of App Domains became valid and the error went away.
I had this same problem yesterday, the stackoverflow answers that helped me the most were
Make local development work with Facebook/Google APIs and Canvas URL / Secure Canvas URL error message ( Also checkout How to handle OmniAuth callbacks in multiple environments?)
The Facebook developer UI has changed a bit. I'm writing this answer to consolidate all the info that helped me.
1. Make local.host Point to Your Computer
First thing you need to do is (as answered in the first link), facebook won't take localhost as a valid callback site, because it confuses localhost with a top level domain (com org etc.) in other words there is not dot . in your domain name. So change your /etc/hosts to add the entry
127.0.0.1 local.host
Now youcan access your app at http://local.host/... (this will take effect as soon as you save /etc/hosts file, no need to restart anything)
2. Add local.host as the Site URL on the facebook Dev Console
The second thing you need to do is add local.host as the site url on the facebook page
Now don't use your production app. Add a dummy app on your https://developers.facebook.com account Because your production app will have to set the site URL to your production URL and not local.host
Configure the dummy app as shown in the screenshot. But that website section(shown in the screenshot) won't be visible on the Basic settings page from the beginning.
First you will have to click + Add Platform button at the bottom, and select Website.
Notice I added http://local.host:3000/. That's where my ruby server runs in dev mode.
Also, be sure to use App Id and App Secret for the dummy app when running your webapp in dev mode.
HTH.
My problem was that logging in with facebook wasn't working for my app.
It turned out that I just needed to fill in the "Valid OAuth redirect URIs" field on the "Advanced" tab.
e.g. http://example.com/auth/google/callback
I'd a similar problem, Facebook have changed now on left pane file login (After selecting you app from top left corner) -> Valid OAuth redirect URIs
If you work on desktop app like WPF or winforms and use a WebBrowser Control to log in with the Facebook SDK.
You have to set to yes the Embedded Browser OAuth Login in Advance Tab of your facebook apps setting.
hope I help
Chose "Add platform" at the bottom and give your localhost url. "http://localhost:port/".
After this step. Facebook allows you to add localhost:port as your domain url.
After these 2 steps you can test "login with facebook" without any trouble.

Facebook app domain name when using localhost

From a tutorial here:
http://ankurm.com/blog/api/using-localhost-for-facebook-app-development/1091/
I tried to set up a Local development Area for my Facebook app. But when I put "http://localhost:85/my_app/" as my domain name, Facebook says
App Domains: "http://localhost:85/app-name/" should not contain protocol information.
Also when I put "localhost:85/my_app/" as my domain name, I get the error:
App Domains: localhost:85/my_app/ is not a valid domain.
It seems like the protocol has been changed.
Here is my solution (I tested on 3rd April 2015 and it works well):
In Settings -> Basic tab
App Domain: localhost
Click "+Add Platform" and choose "Website"
Site URL: http://localhost:<port>/ (<port> is your port number)
Save Changes
My solution:
Leave App Domains empty
(Products) Facebook login > Settings
Add http://localhost:85/my_app/ to Valid OAuth redirect URIs box
Save Changes
Leave App Domains empty
Go to Website with Facebook Login
Add http://localhost:port_number/
Save changes and try again.
For more information visit
http://developers.facebook.com/docs/samples/canvas/
Happy coding :-)
This has changed some over the years, but I just got it to work with a webapp that I'm running on localhost. This is what I did:
Goto https://developers.facebook.com/apps
Select your app.
Select Settings > Basic from the left hand nav bar.
Click the Add Platform button at the bottom of the page.
Click Website
Enter http://localhost:8080/ for the Site URL.
Click the Quickstart button to the far right of the Site URL you just entered.
A new tab will open. On that tab, scroll down to the section, "Tell us about your website" and again enter http://localhost:8080/ for the Site URL.
Click the Next button.
Attempted to login again, and it worked this time.
Good luck!
2018 working solution
It took me ages to figure this out, so I'm going to share my solution.
I tried all the suggested answers, but nothing worked for me, and in the end all I had to do was to go to https://developers.facebook.com/apps/YOUR_APP_ID/fb-login/settings/, and add my full callback url in the Valid OAuth redirect URIs box.
In my case, using ruby on rails, my url looked like this http://localhost:3000/user/auth/facebook/callback.
And right after I added it, everything started working! Hope this helps someone else facing this issue.
This is what I used to do.
If you are using Windows, you need to modify the host file. Host file location will be at %SystemRoot%\System32\drivers\etc\
Add a new line in host file like this
127.0.0.1 localhost.YOUR-SITE-NAME.com
Save the host file.
Go to FB apps setting control panel and give localhost.YOUR-SITE-NAME.com in Apps domain field. Save changes.
Now load you local environment like localhost.YOUR-SITE-NAME.com from your browser.
NB: change YOUR-SITE-NAME with your domain name.
Working solution (August 2018)
First, select your app in the developers dashboard.
Then make sure your app is in development mode, as it allows localhost over HTTP. To do so, click on the toggle situated at the top right of your app's page.
Finally, please follow the notes below as they could cause trouble if improperly filled:
Settings > Basic > App Domains should be empty
Products > Facebook Login > Settings > Valid OAuth Redirect URIs should be empty
You can either leave it blank or use localhost, http://localhost:85/my_app/ is the URL
When I wrote that tutorial at that time port was allowed in app domain. And I actually able to run app with 81 port (wamp server). Now it looks that facebook is not allowing port in url. You can use localhost in app domain.
I will update information as soon as possible. I am trying to find out solution.
A temporary solution is use localtunnel http://progrium.com/localtunnel/
I tested this and it works for me [Feb 2020]:
Install ngrok & get your https url (example: https://a3asdf23.ngrok.io)
Go to FB App Dashboard Settings (Basic) -> under App Domains -> add https://a3asdf23.ngrok.io, https://ngrok.io.
On the same page, scroll all the way down, Add Platform (Website), set the url as https://a3asdf23.ngrok.io. Not finish yet, click QuickStart -> under "Tell us about your website", put the same url https://a3asdf23.ngrok.io.
Then go to Products -> Facebook Login -> Settings -> Client OAuth Settings -> Valid OAuth Redirect URIs -> add these https://a3asdf23.ngrok.io, https://ngrok.io, https://a3asdf23.ngrok.io/{your-redirect-uri}.
And here you go. Thanks me later :)
You must create a tunnel to share your localhost;
Ngrok is maby the easiest way to do that.
https://ngrok.com
Go through https://ngrok.com/ link to download ngrok and extract that file.
Open cmd ( search cmd)
Go to directory where ngrok is extracted.
Open ngrok from command line ex: c:/ngrok/ngrok.exe [port] or cd c:/ngrok then ngrok 80 ( ngrok [port] )
You will get
ngrok
Tunnel Status online
Version 1.3/1.3
Forwarding http://3ahsdfhska.ngrok.com -> 127.0.0.1:80
Forwarding https://3ahsdfhska.ngrok.com -> 127.0.0.1:80
Web Interface http://127.0.0.1:4040
# Conn 0
Avg Conn Time 0.00ms
Don’t FORGET to make sure your wamp server is open on same port …
(how to check -> goto->wampicon->apache->httpd.conf search for port or 80(default) use that for ngrok.exe 80 )
http://3ahsdfhska.ngrok.com
will be URL for accessing your localhost online
I tried all the solutions mentioned here but none of them worked.
What solved my issue was copying the "OAuth redirect URI" from firebase to facebook app "Valid OAuth Redirect URIs"
I left all the domains blank
If you are getting the protocol errors, not only do you need to REMOVE the Http:// but also if there is any backslash at the end of the web address, you must remove that too or it won't work. I did this and it worked perfectly! Holla!
Tossing one more solution into the mix:
I set up my website per the instructions, then added a second app (Facebook Canvas) and set that URL to http://localhost:XXXXX. Now I can access FB both locally and in production.
I develop locally and I use this URL: localhost/fb
Then I had to add a website with the following URL: http://localhost
Under App Domains I added localhost.
Now it works. The only issue I had was, that you have to use this URL in all of your scripts. E.g.
$loginUrl = $helper->getLoginUrl('http://localhost/fb/login-callback.php', $permissions);
You can't use 127.0.0.1 here ...

App Domain: is not a valid domain

any idea why get this error when I insert my site name in App Domain box ,when ntrying to setup app ? I've tried inserting other domains and I get rhe same error message.
Error
App Domain: http://wordpressblogplugins.com/ is not a valid domain.
i had the same problem. the error log is sketchy. this is the solution:
1st goto WEBSITE (below SELECT HOW YOUR APP CONNECTS...) and click
2nd in the text area, fill in your website http://www.yourdomain.info
3rd go back to APP DOMAIN (BASIC INFO) and type yourdomain.info
This absolutely works but I didn't quite understand the instructions, so I'm going to restate them for other neophytes like myself.
From the Facebook development page "Apps-YourAppName", click on Basic in the LEFT Nav.
There are 3 sections on this page: Basic Info, Cloud Services, and "Select how your app integrates with Facebook"
In the Select how your app integrates with Facebook section, select "Website"
Enter your fully qualified domain name in the Site URL dialog box. Example: http://www.mydomain.com OR http://mydomain.com (my site does not include the www so I didn't add it).
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
Now, in the Basic Information section at the top of this screen, you can now add your App Domain. This should be formatted as mydomain.com. Do not add "http://" and do not add "/" at the end of the domain name.
NOTE: My site does not use the www, so I cannot confirm that it's required in Step #6. Try it both ways if you're unsure.
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
At this point the error was NOT displayed as it was before.
Hope this helps!
You should not place URL scheme to the "App Domain" field (it's not a part of domain name), just the domain name like wordpressblogplugins.com

Error App Domain when creating an app

When I am creating an app, I put the URL as specified and it comes up with the following:
Error App Domain: http://coolapp.hobbycraftstore.com/ is not a valid domain. Why isn't it valid? I have also tried domain name http//coolfbapp.com/ and this didn't work either
a domain does not contain the protocol! So just remove http:// and it will work:
domain: coolapp.hobbycraftstore.com
The original author is absolutely correct. However, even seeing other answers with this information, I was still getting errors and didn't know why.
With the help of other answers posted, I finally got it working. Here's the steps that include the complete solution that worked for me.
From the Facebook development page "Apps-YourAppName", click on Basic in the LEFT Nav.
There are 3 sections on this page: Basic Info, Cloud Services, and "Select how your app integrates with Facebook"
In the Select how your app integrates with Facebook section, select "Website"
Enter your fully qualified domain name in the Site URL dialog box. Example: http://www.mydomain.com OR http://mydomain.com (my site does not include the www so I didn't add it).
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
Now, in the Basic Information section at the top of this screen, you can now add your App Domain. This should be formatted as mydomain.com. Do not add "http://" and do not add "/" at the end of the domain name.
NOTE: My site does not use the www, so I cannot confirm that it's required in Step #6. Try it both ways if you're unsure.
At the bottom of the page click the "Save Changes" button. You may receive a notice that it may take several minutes to blah blah blah....but you can continue with the next steps immediately.
At this point the error was NOT displayed as it was before.
Hope this helps!

How to Test Facebook Connect Locally

I use ASP .NET and Facebook Connect APIs. but when I run the app and press Connect button it's return to the Website not to the test local server which is (http://localhost:xxxx/test.aspx)
So how I can test Facebook locally (i.e How I can change the callback url) ?
It's simple enough when you find out.
Open /etc/hosts (unix) or C:\WINDOWS\system32\drivers\etc\hosts.
If your domain is foo.com, then add this line:
127.0.0.1 local.foo.com
When you are testing, open local.foo.com in your browser and it should work.
Edit your app at www.facebook.com/developers/ and set the "Site URL" to "http://localhost/myapppath".
When done - change it back.
Facebook has added test versions feature.
First, add a test version of your application: Create Test App
Then, change the Site URL to "http://localhost" under Website, and press Save Changes
That's all, but be careful: App ID and App Secret keys are different for the application and its test versions!
I suggest creating a test app (for dev environment only) on https://developers.facebook.com/apps and set: Website with Facebook Login property to your localhost:[port] settings.
this option will work fine with no need to change hosts.
remember to change the appId back to your production app once you go live.
Edit - in the latest fb version you'll find it under the settings tab.
You don't have to do anything difficult!
Facebook → Settings → Basic: write "localhost" in the "App
Domains" field then click on "+Add Platform" choose "Web Site".
After that, in the "Site Url" field write your localhost url (e.g.: http://localhost:1337/something).
This will allow you to test your facebook plugins locally.
Facebook seemingly randomly disables the ability to set localhost as a domain on your facebook app. I found the easiest work around was to tunnel my localhost to the web. This can be done for free using http://progrium.com/localtunnel/ or with a custom url (easier since you don't have to change url everytime in facebook) https://showoff.io
I couldn't use the other solutions... What worked for me was installing LocalTunnel.net (https://github.com/danielrmz/localtunnel-net-client), and then using the resulting url on Facebook.
Looks like FB just changed the app dev page again and added a feature called "Server IP Whitelist".
Go to your app and Select Settings -> Advanced Tab
Get your public IP (google will tell you if you google "Whats My IP")
Add your public IP to the Server IP Whitelist and click Save Changes at the bottom
go to canvas page..
view it in browser.. copy the address bar text.
now go to your facebook app
go to edit settings
in website, in site url paste that address
in facebook integration , again paste the that address in canvas url
and also the same code wherever you require canvas url or redirect url..
hope it will help..
LAST TESTED 2021/06/07
Just a few notes to complement the excellent answer of #Erdal_G with my successful experience:
Apparently, HTTPS is needed even in the local environment (I used the library https-localhost).
[I don't know if this is mandatory] create a test app from the main app (https://developers.facebook.com/docs/development/build-and-test/test-apps/)
Set the redirect OAuth URI to https://localhost:<MY_PORT>/auth/ and update also all other URIs in .../instagram-basic-display/basic-display/ settings accordingly.
Finally, don't forget to use the client-id (aka app-id) and app-secret of the test app in the requests, which are different than the parent app
Create 2 apps and
In /initializers/env_variables.rb
if Rails.env == 'development'
ENV['FB_APP_ID'] = "HERE"
ENV["FB_SECRET"] = "HERE"
else
ENV['FB_APP_ID'] = "HERE"
ENV["FB_SECRET"] = "HERE"
end