Automatic Login with facebook using a subdomain from My App - facebook

I know this is an old answer but I think the context is different for my use case.
I am trying to log in with Facebook and in the configuration of my application in Facebook I have my web application. For example the URL of the site I have is website.com. However, I am actually using subdomains, in this way, my application generates subdomains belonging to my clients. For example, the URL of my client in my application
to login is: subdomain1.website.com The error message I get from Facebook is:
JSSDK Unknown Host domain: The domain where you host the Facebook Javascript SDK is not in the list of host domains in your app's Javascript SDK. Specify your host domain in the app dashboard login settings.
How can I login with Facebook using a subdomain? Obviously, I don't want to add the sub-domains every time a new customer comes to my application.
Pd: I thought that with adding to Allowed Domains for the SDK for JavaScript *.website.com
but that doesn't work.
I hope your answers, thank you.

Related

Use same app on multiple domains

I'm creating a Social Media management webapp. This webapp will be used by our customers on there own sites (read, own domains). The webapp connects to a facebook app that we own, to allow them to manage there pages.
I'm using the "Website" platform for the app. During development I've had the "Site URL" set to my localhost url, and the "App Domains" set to localhost. This has worked fine.
However I now realise that this app will not always be run from localhost. It will be run from many differnt domains. I've read many posts about how its not possible to do this anymore, or at least the max is 5 domains by adding multiple platforms.
So how am I supposed to do this? Will I need to create an app on my profile for each customer/site? Will I have to create an app on each customers facebook account and link its app ID to our webapp?
The solution for this was not so bad.
Since AccessTokens are portable, so you can generate them on a single domain, and then use them to access the API from any page.
To do this, I have setup a single page on my own server (not customers server), whos domain is in my Apps Domains property. This page just has the facebook JS SDK, and some code to handle whether or not to show a login or a logout button. I embed this as an iFrame inside my webapp (that can run from any URL). I use
FB.Event.subscribe('auth.authResponseChange' function {});
to look for status changes, then use the the JS postMessage method to send the result of this to the parent of the iFrame, who then sends it to the server. This AccessToken can then be used anywhere.

Can I use my authorized facebook app on subdomains of my own site?

Many of our users currently use facebook connect to login to our site at www.mysite.com. We have a related application hosted at "subdomain.mysite.com". We want existing users to be able to login using facebook connect on the subdomain. Is there any possible way to do this?
I've found this related SO question with one answer claiming it is not possible, and we would have to create a 2nd app that the user would have to authorize separately. I'd like to verify 100% that it is impossible to login from a subdomain before giving up, however. Are there any workarounds at all?
By settings you App domains settings it's of course possible.
In you app settings on Facebook, you have a field called App Domains. In this field, you can add a main domain example.com and this will allow every subdomains: *.example.com.
Quoting FB:
Enable auth on domain and subdomain(s) (e.g., "example.com" will enable *.example.com)
Hope this help!

What is App Domain in Facebook Apps?

What is App Domain used for in Facebook Apps?
Somebody had asked the same in What are App Domains in Facebook Apps? but I didn't really get it.
What I am trying to do is "publish actions" from a mobile app. The object to be published must be stored in a separate web page. And the domain of the separate page is supposed to be included in app domains.
Is app domain applicable for Mobile apps as well?
Well AppDomain simply means where is located your application's server side files.
Your application only usable from that domain. Facebook needs data for cross domain and security issues.
Unless you're going to use FB auth for a website you don't need to fill App Domain input.
I encountered the same issue for my mobile app. To fix it, I set the App Domain to my domain. But that wasn't enough because I then got the error:
Error
You have specified an App Domains but have not specified a Site URL or a Mobile Web URL
puurbuy.com must be derived from your Site URL or your Mobile Web URL.
So I had to go one step further and enable "Website with Facebook Login" setting the URL to my homepage, even though I do not have a Facebook login on my website. A terrible work around in my opinion, but it worked.
Because not using Sandbox Mode:
1. Had to establish a category on appdetails page
2. Had to set Website with Facebook Login
3. Then able to set App Domain
Now the debug pulls in the correct information without error.
App domain is not something related to your app or web domain, this is basically a App Store address.
Simply write this line in App Domains.
apps.apple.com
this worked for me.

What are App Domains in Facebook Apps?

I want to add the ability to 'login with Facebook' to my site. But I am confused when I register my site in Facebook Apps. What should I input into App Domains?
the app domain is your domain name.
Before you enter your domain, first click on Add Platform, select website, enter your site URL and mobile site url. Save the settings.
Thereafter, you can enter the domain name in the App domains field.
See more at my blog: http://www.ogbongeblog.com/2014/03/unable-to-add-app-domains-to-new.html
If you don't specify the platform for the app you won't able to add app domain correctly.
Here is an example -- validate that its a type a website platform.
To add to the answers above, the App Domain is required for security reasons. For example, your app has been sending the browser to "www.example.com/PAGE_NAME_HERE", but suddenly a third party application (or something else) sends the user to "www.supposedlymaliciouswebsite.com/PAGE_HERE", then a 191 error is thrown saying that this wasn't part of the app domains you listed in your Facebook application settings.
In this example:
http://www.example.com:80/somepage?parameter1="hello"&parameter2="world"
the bold part is the Domainname. 80 is rarely included. I post it since many people may wonder if 3000 or some other port is part of the domain if their not staging their app for production yet. Normally you don't specify it since 80 is the default, but if you just want to specify localhost just do it without the port number, it works just as fine. The adress, though, should be http://localhost:3000 (if you have it on that port).
it stands for your website where your app is running on.
like you have made an app www.xyz.pqr
then you will type this www.xyz.pqr in App domain
the site where your app is running on should be secure and valid
It's simply the domain that your "facebook" application (wich means application visible on facebook but hosted on the website www.xyz.com) will be hosted. So you can put App Domain = www.xyz.com
I think it is the domain that you run your app.
For example, your canvas URL is facebook.yourdomain.com, you should give App domain as .yourdomain.com

Given URL is not allowed by the Application configuration

I am trying to use the Facebook javascript sdk for my chrome extension. Since it is a chrome extension how do i integrate it with facebook? is it an app on facebook.com or a website?
Currently i have it as a website.
my site url on the settings is:
http://localhost/Users/home/Documents/facebook/
i have also enabled web sharing on my mac.
do i need to set the site domain as well? what am i doing wrong here?
Enter http://localhost/Users/home/Documents/facebook/ as your "Site Domain" on the developer app:
https://developers.facebook.com/apps/{api_key}/summary
Replace {api_key} with yours; or find a link at https://developers.facebook.com
Interestingly enough, Facebook lets you type anything into the domain so it can be an offline URL (such as localhost or a local port) and Facebook will redirect to it after authentication.
You can test Facebook applications locally if you add an entry to your hosts file which points to any subdomain of the root domain you gave Facebook. For example, if your domain is example.com, you can add entry to your hosts file pointing fbtest.example.com to localhost (127.0.0.1).
You can then test away locally without having to edit your Facebook app configuration (assuming your local server is set to serve the same content to all subdomains).
Alternatively, if it's important to have the exact domain, you can just add an entry for the root domain. It just means you won't be able to access the live site while testing.
In order to develop and publish a Facebook application, you must provide a web accessible URL that Facebook can query. If you have webspace you can upload to or make your IP available to the web for Facebook to call, it should solve your problems.
Facebook will allow you to put just about any valid url into the box, however when you go to use it for logins or general use, you will begin to notice errors, since Facebook's spider cannot fetch the url.
Check the 'Desktop Apps' section of https://developers.facebook.com/docs/authentication/
This explains how to do authentication where there's no server involved, it's aimed at desktop apps but a browser toolbar should work in a similar way