Facebook friend invite code - facebook

I have a javascript function to invite facebook user's to my "app" which is my website where you can login using facebook. When the user clicks invite friends, the invite friends dialog pops up, you can invite your friends and all is fine. When the friends who got invited go to their facebook, they get the notification to come use the app. However, when they click the notification it says this (for me cause im the developer).
http://img843.imageshack.us/img843/5708/screencapturezk.jpg
I want it to actually take me to the page where the user has to allow the app permission like so :
http://img580.imageshack.us/img580/4337/screencapture1v.jpg
I know it's not the javascript... It has to be an app setting. I don't understand the canvas url part. I've looked into it, and it looks like you only use that when you have an app that operates through facebook, but from your website. That's not what I want. Any help please? It's driving me nuts!

The error message should have pointed you to the right place I think, it's saying that you haven't specified your canvas URL and secure canvas URL - these settings are configured under 'App on Facebook.com' in the app settings.
Invites go to your the root of your Canvas App (i.e apps.facebook.com/something - which maps to the 'canvas url' and 'secure canvas url' fields in the settings ) - if you need to redirect them somewhere else after processing the Request, you've to implement that yourself

Related

Facebook always return error when authorizing my application

I'm trying to build a Facebook app, but everytime I click in authorize, I got an error.
In the code, I'm calling the Facebook API like this:
https://www.facebook.com/dialog/oauth?
client_id=MY_APP_ID
&display=popup
&redirect_uri=http://www.my-url.com/823/
&scope=user_about_me
But instead of authorizing the user, the browser redirect to this URL:
https://www.facebook.com/dialog/permissions.request
And I always get this error:
SECURITY WARNING: Sharing the above URL with anyone is the same as
sharing your Facebook password with them - it will give them access to
your Facebook account. Despite what you may have been promised, you
will not receive cash, a gift card, or free airline tickets in
exchange for this URL.
My Facebook Settings Page:
http://i.stack.imgur.com/g9S9m.png
What am I doing wrong?
Any help would be appreciated! :)
PS: I just tried to change the "redirect_uri", from my site's URL(www.my-url.com/823/) for the canvas page(apps.facebook.com/my-app), and it works.
But I want it to redirect to my site, not for the canvas page.
I had another application that was removed by Facebook last week. The domain I'm trying to use is the same of that old app removed. Is it possible that Facebook put the domain in a black list? Or am I just missing something?
Have you tried to replace the « Website with Facebook Login » by the original URL? (Without the example path (823))
By the way, don't forget to complet app domains.
The problem was that my app was removed by Facebook. When this happens, Facebook puts the site domain in a black list.
The solution was to redirect to the canvas page.

How does a Website with Facebook login work practically?

If I create an app for my wesite under the tab 'website with Facebook login' - how does this work for users accessing my site?
Do users HAVE to sign in with Facebook to view my site?
Or would they only be prompted to sign in if they were not signed in and they clicked my Like or Send buttons (the only button's we'll have)?
If a user doesn't click the like or send - will they be affected?
As much details about the user experience as possible wouldbe great. Cheers all!
Facebook login is usually just a wrapper on top of your website that allows you to get Facebook user details if they use Facebook. You will still need a system to track who is actually logged in to your site and they will still have to click the "Login with Facebook" button.
On the other hand, the Like and Share buttons are independent as they simply send your website data to Facebook and Facebook does not send anything back to you.
You do not need Facebook login functionality to put Like or Share features on your page.

Facebook Logout Button for My Website (Not Facebook Connect Logout)

I was wondering if it is possible to create a "logout" button for my site that will log a user out of facebook and then redirect them to a specific URL ? Let me elaborate, I work in a retail store and I have a mounted iPad so customers can "like" our facebook page (by using a traditional facebook like button). Currently, when customer's select "like" it opens a new window where facebook asks for a username and password, and then immediately after the customer hits "Submit" it re-directs them back to a specific URL where I say "thanks for liking us"...the only problem is that it keeps them logged into facebook.
I'm hoping to put a logout button on my "thank you for liking us" URL so they can click that to logout (without going back to facebook) and then it re-directs back to the page with the like button for the next customer.
I have tried facebook connect but it's so many steps because users have to allow the app etc. that I'm hoping to avoid that. Maybe a way that clears the facebook cookies or anything else? I'm so out of ideas that anything will help!
Include the Facebook JS SDK and then call FB.logout() either on click of the link, or on the thank you page.
Tested, not working even with FB.logout(), because once you logged in facebook.com, then fb cookie will be injected automatically, there's no way to remove it unless you've logout from facebook.com.:/

app.facebook.com/app_name/ - to redirect to a external url after clicking "go to app"

I know there is a way to redirect the page using javascript in the iframe of the canvas application to an external url.But is there any other way so that user directly gets redirected to the external url as soon as they authorizes the application.
i know it is possible because a famous app klout in Facebook does it.http://apps.facebook.com/klout__/
redirects to
http://klout.com/ automatically as soon as the user
Remember i got an invitation request from my Facebook friend.when i clicked the invitation notification and when i authorized the application it redirected to a external url.Any idea how this has been done? And i think this wont be encouraged in Facebook policies either?
Facebook want to make sure that the servers it interacts with are of the same domain that is set up in the app settings.
In the klout example you gave what they did was to add an App Domain which is done in the app settings, but there's a limitation to what domains you can add there.
For example if your site url in the settings is set to "www.example.com" then you can add "examlpe.com" or "sub.example.com" to the app domains.
But if you try to add "www.example2.com" you'll get:
Error
example2.com must be derived from your Site URL or your Mobile Web
URL.
Edit
I'm sorry, I did not understand you correctly.
If you want to simply redirect the user to your url in the main window then you can use javascript like this:
top.location.href = "http://www.example.com";
What I was referring to before is the ability to have "www.example.com/" as the site url (in the settings) and still use "sub.example.com" with redirect_uri and such.
2nd Edit
Forgot to mention this:
In the Facebook Platform Policies it states that:
13 . The primary purpose of your Canvas or Page Tab app on Facebook must not be to simply redirect users out of the Facebook experience
and onto an external site
And so you should not redirect the users out of facebook.

Facebook Permissions Dialog in Page

I've created an app that works fine, however if the user has not authorized my app yet, they have to do the following (assuming they are in facebook AND logged in) -
go to my app
click login/authorize
popup with facebook permissions opens
accept in the popup
However I noticed with Zynga games like Mafia Wars 1/2, Farmville etc, when you go to the app, if it hasn't been authorized, it takes you straight to the permissions which is in a PAGE and not a popup, thereby eliminating one step. Also, the permissions dialog is full width, there is not app sidebar.
Does anyone know how I can duplicate this flow? It would be much easier to have users authorize within a facebook page rather than through a popup. How can I get permissions inside the page?
thanks in advance
Once user visit a Page tab with your application you can check if he is connected with your application by comparing Page ID with User ID in signed_requests, for unauthorized users ID's will be same. In that case you can start authentication flow by redirecting user's browser to "login url".
If you want it to be full page just do the redirect with JavaScript like this:
window.top.location = 'https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=COMA_SEPARATED_PERMISSIONS'
If you using PHP you can construct Login URL by calling Facebook->getLoginUrl method.
Read the docs on Facebook authentication