Use same app on multiple domains - facebook

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.

Related

Automatic Login with facebook using a subdomain from My App

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.

How to use facebook appid to work with multiple domains (not sub domains)

I have created an app on facebook and i am using that appid in my application to allow the users to login, like & share the content.
While creating the facebook app i have given a domain like "abc.com" in the "App Domains".
This is working fine when i access the page from "abc.com/mypage" but i want to do the same from "xyz.com/mypage", "xxx.com/mypage" etc....
The facebook login is working for only "abc.com" it is not working for otherdomains.
How can i make this work and i want the same behavior for multiple domains more than 2
Thanks,
You can only use one domain per "platform". Meaning, if you got 2 different Websites, you need to create 2 different Apps. But you can use the same App for a Website on one domain and a Page Tab or Canvas App on another domain (which is useful for testing on localhost, for example).
Solution is to have multiple applications.
Look closer at the Settings-Basic, you would find that the domain setting is at the top and is global. Try to add a second domain and you see this error message: "This must be derived from Secure Canvas URL, Mobile Site URL, Unity Binary URL, Site URL or Secure Page Tab URL".
And that's the solution: You can make your secure canvas url abc.com, mobile url xyz.com and siteUrl example.com.
I guess your abc.com is for "Website". So what you need to do is click "Add Platform - Facebook Canvas". And enter xyz.com/ as canvas url and example.com/ as mobile url. Then you can have three domain supporting signing in at the same time.
Facebook acknowledges that people have the need to use different domains for different purposes. But they decided to allow only one domain per purpose. The error message suggests that you may have up to five different url and hence five domains.

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.

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

Facebook External Widget development with a single app

We're trying to develop a widget that uses Facebook APIs and other websites (e.g different domains) could embed. We do not want every website to create it's on Facebook app but we'd like everyone using this widget to be connected to our Facebook app.
The problem is that Facebook seems to authenticate only a specific domain for an app (Canvas URL).
Ideas?
Guy
Update: I just realized that for Facebook server API as long as I set the redirect_uri to a valid URL (as defined by the site url) then everything is OK. So I can let my widget call the login and set the redirect_uri to some page we hold on our server that will communicate with the origin. So far so good. Now the problem that remains is whether there's a way to do it using the Facebook JS sdk rather then having to invent the wheel. From what I see there I could find a way to make the JS SDK not use the window.location.href. Ideas?
you just need to create the app, then from the profile site of your app there is an link to let users add the app to their page. (this is also possible via a special link (see the docs))
but be aware, one page can only include your app once. so if you like your "customers" to have your app multiple times on the same page you have to create multiple apps but point the canvas and tab url to the same script.
The other way would be to add child applications directly for the user, so you can let your customers even set a customized icon. This is hard to code couse you have to use old apis (newer one doesnt support the functions anymore) and there is none to null documentation for it. (I have such an app running, if you want to see some examples drop me a note)