Does facebook allow login on any unknown domain policywise? - facebook

I am thinking of distributing a Flash game that can inject Facebook JS into any webpage that will host it (many free Flash game portals). I can window.open Facebook login dialog when the host page sets allowScriptAccess.
One of my ideas how to workaround the crossdomain login issue (how to get accessToken back to my Flash game hosted on unknown domain, without fighting cross domain JS and all those browser issues)
Flash generates unique token (tag)
Flash opens comet connection with the tag to our server
Flash opens OAUTH dialog, forwarding tag in redirect_uri to allowed
domain
User signs in with Facebook credentials and is redirected to
redirect_uri with active accessToken (CODE) and tag
Facebook redirects to our server passing accessToken
Our server grabs CODE and tag from GET params and extracts accessToken
Our server forwards accessToken to Flash by comet recognized by the
tag
Finally - Flash can use facebook features with valid accessToken
As I am not a lawyer and those facebook policy docs are not understandable to me...
Question: Would facebook allow this kind of login on any domain? I feel I would be working around some security this way.

The facebook platform policy does not limit you from doing what you want. As long as you pass the login process through your domain (you don't have any other option) and add a "logout" link, you will be fine.

Related

For Janrain Sign In with Facebook, how to configure website and app domains on Facebook?

The instructions from Janrain for social login provider setup conflict with the hint within the error message from the Facebook https response. Details follow.
Error screen when testing Facebook from Janrain; note that same error happens in any browser such as Firefox, Chrome if you test the sign-in widget.
Error Text from Facebook:
App domains must match the domain of the Facebook Web Games URL (https), Mobile Site URL, Unity Binary URL, Site URL or Secure Page Tab URL.
Please correct these domains: (snip).
Based on the hints from the Janrain Facebook Provider Setup wizard, I have set the website to the URL on rpxnow (i.e. definitely not my web site).
What URL(s) should then be entered into Basic and/or Advanced Settings such that Facebook can process the login? I have tried using the rpxnow URLs and my own web site URLs. Either of 2 things happens regardless of whether I include https:// or start from the subdomain of any combination of names. Either Facebook will not save the details on Basic App Domain and gives the above error, or Facebook will save the details but then gives the error in the first screenshot above.
I do not see how this can ever work because Facebook wants a match on the domain and rpxnow will never be the domain that I use to invoke the sign-in.
For completeness, I will show my Facebook settings, so it will be obvious that they do not match the current Janrain Setup Guide for Facebook.
Basic Settings
Is the Namespace relevant? Better to leave blank? Does it need to match something within Janrain?
Advanced Settings
I could believe that something has to be done to allow cross-domain access. Does anyone have this working with a new Janrain account (3 weeks old) and a new Facebook developer account (old Facebook account, new developer app)?
Replying as an answer so I can attach a picture.
I have a feeling this might be something to do with Facebook's impending changes to their app security (https://developers.facebook.com/blog/post/2017/12/18/strict-uri-matching/ ). It appears that you need to add the Valid OAuth redirect URI for any new API v2.11 apps now (not after March). We were already planning to address this before March but we will have to update sooner.
For your Facebook app you will have to set up the "Valid oAuth redirect URIs" similar to the following screen shot, just replace "pbjanraintest" with whatever your Engage app name is:
Sorry for all the trouble you have had. It's hard to keep up with these providers when the messaging doesn't align with what their apps and api's are actually doing.
I just received the same error this week. Leave off the https:// in the OAuth redirect URIs box.

Facebook Login Integration Error:

I'm working with a contest platform and am trying to get it to where and individual can create an account via Facebook.
The biggest issue I'm running into is that whenever I enter the domains into the App Domains portion I receive this:"App domains must match the domain of the Secure Canvas URL, Mobile Site URL, Unity Binary URL, Site URL, or Secure Page URL. Please correct these domains:"
Additionally, when I attempt to test the Facebook login button, I receive this error message in the pop-up:"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 inquired with the Support Team from the contest platform and was informed of this:
"We had the Engineers look at this issue on your site and it looks like the configuration in facebook might not be correct.
What you need to make sure of is that facebook login authentication is enabled for the Website (Web) then only it will work.
The app domain:------
Contact email: your email address
Then in the Website section
Site url:------"
I can't seem to locate where the "Site URL" section is that I need to be putting in a url. I've put in the OAuth Client Redirect URLs...maybe they aren't correct?
Need some major help here.

post facebook feed on Flash AIR Desktop using AS3

I need to share Facebook feed using https://graph.facebook.com/me/feed, so I searching and researching until I stumble upon FacebookGraphAPIDesktop.swc. But I failed to login, I already populate the required field (APP_ID, APP_ORIGIN) and make an adjustment on facebook app page too (App Domains & Site URL).
I already init the FacebookDesktop class and try to make a login connection using
var permissions:Array = ["email"];
FacebookDesktop.login(onLogin, permissions);
But it show popup windows contain JSON Invalid redirect_uri, OAuthException, code: 191
Any direction for dong this? bassically I need to show facebook OAUTH login popup and show feed dialog after the login success.
The environment is Flash AIR 17 running on Desktop (not mobile)
When working with Facebook for desktop and not using your own backend servers for login support, set the redirect URI to to https://www.facebook.com/connect/login_success.html.
If you are using your own servers, then the redirect URI should be set to the page that is going to handle the response from Facebook.
In either case, you will need to make sure that you log in to your app on the Facebook developer portal and set the app settings for desktop login and set that redirect URI in there.

Facebook login with multiple domains

I know that facebook allow me to specify multiple domains for my app.
But in the "Website with Facebook Login" i can only specify one url.
Is it possible for me, to authenticate users on domain.se, domain.dk and domain.net with the same App ? Or should i still create one app, for each domain ?
It is technically possible to use Facebook Connect on multiple domains, there are some limits (5 domains max).
So the key to doing this is adding all domains in the App Domain field under your app settings.
The PROBLEM, however, is that Facebook only lets you add domains that are derived from your Canvas URL or Site or Page tag URLs, so if you try to enter anything else you get an error that looks like this:
The SOLUTION is to create App on Facebook, Website, and Facebook Tab using the ADD PLATFORM button and then put in URLs that point to your other domains. Here is an example of what I mean:
If you use a unique domain for each field you can max out with 5 different domains. I have tested this technique with up to 3 domains, but i think it should work for all 5.
Note: Facebook admin features change from time to time, so all of this is subject to change
As long as you listed all the desired App Domains in application settings you should be able to authenticate users on any of them.
"Website with Facebook Login" is really only intended to be used as link to your site/application.
Update 2 (July 2016):
App domains must match the domain of the Secure Canvas URL, Mobile Site URL, Unity Binary URL, Site URL or Secure Page Tab URL.
Update (December 2013):
At the time of writing original answer it was possible to list any domains in application settings but from that time the UI of Application Settings (as well as way of handling Application Domains) changed at least couple of times, at some point you could only list domains that derive from one of application's canvas pages.
As of December 2013 it is possible (again) to list domains that do not derive from application canvas URL.
Assuming your domains are being served by the same web server and you have access to that web server, you can use the manual login procedure: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow to login from as many domains as you wish.
Assume your domains are site1.com,site2.com.... Instead of using the Facebook javascript API, you will simply place a plain old Log In with Facebook button on each site which will redirect the browser to the facebook login page as described in the above article. In the state variable you can specify a code which indicates which of your sites is requesting a login. In the redirect you will use a single service domain which you assign to your web server (e.g. fb.mywebserver.com) and which you specify as the verified redirect url in the facebook login settings page. All the sites will redirect to this same url, avoiding the problem of supporting multiple domains.
Once the user has logged in, the browser will redirect to fb.mywebserver.com and pass it the state, which tells you which site is requesting login and a code which you can use on the back end to retrieve the user's info using the Facebook graph apis. You store this info with a uid in your data store then using the info in state, you redirect to to the appropriate site including a parameter that indicates a Facebook login (e.g. site1.com?fbc={some uid}). The browser will obediently then call site1.com?fbc... Your web server will receive this request and detect the fbc parameter which tells it to associate the corresponding Facebook logged in user with this site. It can then retrieve the logged in users info using the uid and, for example, return a session cookie for this user along with the page. If you generate the page on the server you can, of course, also include a welcome "user" or alternatively, your client code can do an ajax call to retrieve that information.
From the user's standpoint they press the Login with Facebook button, are redirected to a Facebook login page where they login and then are redirected back to your site in a logged in state. Not quite as nice as having the login popup but likely acceptable.
A similar process can be used for google logins as well
Best thing I've found to do in the development/production scenario is add a "Test App", then add a platform for your development web site - as you have to provide where the "page tab url" lives if you use that as a platform.
Facebook requires your "page url" to be live / accessible if you need to apply for status or permission review.
This got me around the "login in development" / "login in production" scenario.

Facebook site url - redirect to different urls within same domain

I have created a facebook app on developers.facebook.com and specified a site url for my website. When users on my website login with facebook it redirects them back to the site url I specified (e.g. example.com) on the facebook app settings.
I also have a mobile web site which has facebook login but when users login from the mobile site (mobile.example.com) it still redirects to the main site (example.com).
How can I make facebook redirect to either example.com or mobile.example.com depending on where the facebook login request comes from?
Facebook allows you to pass a variable named state to the auth dialog. This value gets returned by Facebook on both success or failure.
The intent of the state variable is to prevent people from gaining access to your site with forged requests. However, you could add a string to the state variable unique to people coming from the mobile site. On your redirect page registered with your app, you just need to add code to examine the state variable and redirect the user if it has the "mobile" string in it.