I have a facebook app and i want to increase the login conversions so i want my users to land on my app's home page to see what i'm offering and then once they clicked they will get the auth dialog.
How do i do this?
Thanks
There's no guarantee that adding a landing page will increase conversions. In fact, it may hurt by adding additional clicks to the funnel. However, if you want to try it, here's what you need to do.
Facebook does not prompt for auth until you tell it to. In order to allow your users to see a landing page before prompting for auth, make sure you do the following:
1) Ensure "Authenticated referrals" are turned off. This can be done in the Developer App under Settings > Auth Dialog
2) If using the JS SDK, make sure you are calling FB.getLoginStatus() so you can redirect users that have already authorized your app to the appropriate page. (You can also do this server side, using the PHP SDK or equivalent, to avoid the client side redirect).
3) If using the JS SDK, don't call FB.login() until you are ready to prompt for auth. For instance, you can call this in response to a user clicking a login button on your landing page. If not using the JS SDK, don't redirect to the auth dialog until after the user clicks your login button.
Please read this carefully:
http://developers.facebook.com/docs/reference/androidsdk/dialog/
void dialog(Context context, String action, DialogListener listener)
Generate a Facebook UI dialog for the request action in the given
Android context.
Parameters
context - The Android context in which we will generate this dialog.
action - The type of dialog to call. Currently supported methods are
feed and oauth.
listener - Callback interface to notify the application when the
dialog has completed.
Return Value
None, the callback interface will be notified when the request has
completed.
Note
This method is asynchronous and the callback will be invoked in the
original calling thread (not in a background thread).
Related
I have a Facebook Page tab app. For a user who is not logged in, I want to:
Detect if user is not logged in
If not logged in, automatically direct user to login
My current approach is to use FB Javascript SDK (in preference to server-side authentication flow):
On page load, run FB.getLoginStatus to check user status
If user is not logged in, run FB.login to invoke OAuth dialog
Problem:
FB.login creates a pop-up dialog (prefer if within Page Tab iframe)
This pop-up dialog is blocked if FB.login is not invoked from a button (I would really like to avoid having the user click a button; so would really like to invoke it automatically, when I find a user that is not logged in)
I would really like to avoid having the user click a button
FB.login without user interaction -> blocked popup
prefer if within Page Tab iframe
The Auth dialog won’t work inside an iframe, it’s designed that way.
If the automatic call of the login dialog is your most important requirement – then use JavaScript to redirect to the Auth dialog URL, and redirect back to your page/app Facebook address afterwards. See section “Client-side authentication without the JS SDK” here: https://developers.facebook.com/docs/authentication/client-side/
We are integrating an application as a facebook app at work. I want to be able to detect whether the user has logged in to facebook, and if not, to prompt for authentication.
So far we have successfully used the facebook SDK and the login functionality it provided. However, this causes an authentication popup window to be created by our application, and it is being blocked by most of the browsers, so our priority task is to re-implement the authentication logic not to use popups.
According to the this tutorial from the facebook documentation it could be done either by using event subscription for user status change requests (which did not work when the user is logged out) or by obtaining access token. The problem is that the token is returned as request parameter to the top window (the url I specify as a return url after the user authenticates). Since some cross-domain and browser restrictions exist, I am unable to use client scripting to obtain the value, and I am stuck.
Related questions here have been asked and the common issue is that most apps are being ran on localhost. However, the case with our app is that we have deployed our app to local webserver, that is exposed by a public domain, but still has the cross-domain restriction issues. It is being referenced by its public domain name within the facebook app configuration. I am completely confident in that the domains are fully accessible from outside.
In general, our case is that we would like to host the app while it is being used by facebook users. Perhaps this approach might be incompatible with our requirement? Is it possible to configure cross-domain communication to avoid the issue? Are any other ways to do avoid facebook login popups?
First of all, default settings for popup blockers in modern browsers are so that they only block popups that are called without user interaction. If you call FB.login automatically on page load, it is likely to get blocked. But if you offer a link/button to the user saying “log in here” and only call FB.login on click on that link/button, then the popup is rather likely to be shown and not blocked.
If you are not willing to do it that way – then your other option is to use the server-side auth flow. You can just redirect the user to the auth dialog, which will happen in the same window, and he will be directed back to your app afterwards.
When users click on our action link on timeline, they are being asked to add the app with its proper permissions and then redirected to the object page on our website. But, when they do so, they dont become facebook-logged in to the website until they click "facebook connect" button which refreshes the page and makes them logged-in. Any comments are highly appreciated.
Well, they can’t be logged in, because Facebook hasn’t had a chance yet to set a cookie under your domain in your current flow.
Embed the JS SDK and call FB.getLoginStatus for users have arive that way, and have your page reload in the callback function (you might want to check success first, because you never know …) Then you should have them logged in. (Make sure to set cookie-parameter to true in FB.init. And make sure to call FB.getLoginStatus + reload only once.)
I am using fbconnect api in my project.When the login dialog gets opened where we entered our credentials ,when I click on login button there is something performed and it is redirected to the publish page.
My problem is I am not getting which action is performed on that login button so that I can put an indicator over there.
I have attached a screenshot to specify which button I am talking about.
Any suggestions will be highly appreciated!
Do you want to steal others' Facebook passwords? :)
It seems, FBConnect uses UIWebView to load the pages from web. Those form elements are not created from the code. So you can not have the access to those methods/actions.
Tracking the login button action using UIWebViewDelegate:
In webView:shouldStartLoadWithRequest:navigationType: delegate method in FBDialog.m, you can see the request which are sent from the login view.
You can read the URL by using [request.URL absoluteString].
Check if that URL contains the string https://www.facebook.com/login.php?m=m. If it is YES then probably a login request is being sent. You can do your action there.
Note: I am not sure this will always work. You can do further research to find a better solution.
When you push login button - the login request will send to FB server only. To get answer you need to implement FBSessionDelegate protocol:
/**
* Called when the user successfully logged in.
*/
- (void)fbDidLogin;
/**
* Called when the user dismissed the dialog without logging in.
*/
- (void)fbDidNotLogin:(BOOL)cancelled;
/**
* Called when the user logged out.
*/
- (void)fbDidLogout;
Read also comments in Facebook.m:
Starts a dialog which prompts the user to log in to Facebook and grant
the requested permissions to the application.
*
If the device supports multitasking, we use fast app switching to show
the dialog in the Facebook app or, if the Facebook app isn't installed,
in Safari (this enables single sign-on by allowing multiple apps on
the device to share the same user session).
When the user grants or denies the permissions, the app that
showed the dialog (the Facebook app or Safari) redirects back to
the calling application, passing in the URL the access token
and/or any other parameters the Facebook backend includes in
the result (such as an error code if an error occurs).
I have a ASP.NET web site which uses Facebook Connect for authentication - using the JavaScript API and the Facebook Connect FBML Button.
Here is the regular flow of events for a "Connect with Facebook" button click, when user isnt logged into Facebook.
Dialog is shown requesting user to login
Dialog requests permission from the user for basic info permission
The popup is closed
The callback function i supplied for "onlogin" is fired.
All good.
Now - here's what i think is a bug: the user is already authenticated to Facebook, but has not authorised my app.
This is the flow:
Dialog is shown requesting permission from the user for basic info permission
The URL for the popup changes to http://rootofmysite.com/?installed=1&token=3e3920d309
The user is left wondering what is going on, and the onlogin callback is NOT fired.
So, the popup window is replaced with my original site, and in the querystring is the OAuth token? This looks to be the "Post-Authorise Callback" URL which used to be in the Facebook Application Settings - but has been removed. Anyway, i dont care about this URL - i request permissions/authorization using the client-side JavaScript API, as im a sure a lot of people do.
I understand the user is already authenticated, so they wouldn't need to login again, but what i dont understand is a) why the "onlogin" event handler is not called, and b) why on earth are they replacing THEIR dialog with my site and the OAuth token in the url?
At the moment, i am trying to do a "creative workaround" where i detect this URL and close the popup and call my "onlogin" handler manually (what Facebook SHOULD be doing).
Still, quite dodgy.
EDIT
It's another bug peoples. Please vote for it so they fix it.
It's a (unconfirmed) bug.
http://bugs.developers.facebook.net/show_bug.cgi?id=12260
Hopefully it gets more votes so it gets fixed - vote people!
In the meantime, i am (attempting) to employ the following 'creative workaround':
Add logic to my Default.aspx page to detect that URL they are redirecting to in the popup.
Redirect to my page, FacebookInboundAuthorization.aspx, preserving querystring.
On load of that page, register some JavaScript to close the popup and manually fire the "onlogin" event handler for my button.
EDIT
To clarify my above, i didnt mean "vote people" as in to vote for my answer here, i meant vote for the bug on Bugzilla (so that FB accept it as an issue and fix it).