Handle user on facebook like gate - facebook

I'm coding a facebook like gate and this is a screenshot of my config : http://www.kreatoo.com/rav/facebook_info.png
I need the Signed Request ($facebook->getSignedRequest()) for know if the user like this page or not, and i have this information only the first time. If i click on a link i loose this information..
In second time, when i login my user (with $facebook->getLoginUrl()), facebook redirect on the server (www.vibrantmarketing.ca/...) and not on apps (https://www.facebook.com/coppertone/app_432377713445313..).. I try with "redirect_uri" or "next" option but nothing...
Thank you all for help
PS : For interested the application is : https://www.facebook.com/pages/TestCactOos/255835411190164?sk=app_335457189856398

Let's start in your first quesiton
Facebook Like Gating - you actually don't need to request to sign in your app just to gate your Facebook Like. In your situation for example, you use the app for Facebook page and you can get the SignedRequest on that moment buy not requiring the user to sign to your app.
Again , I check out your app and it redirects me in the url below: which is good for me, the only thing you need to do is redirect your user if the page was not viewed in the iFrame.
https://www.vibrantmarketing.ca/coppertone/facebook/littlemiss/en/like#_=_
Note:
One thing, when I checked your app it redirects time to time. I think it's because of your Javascript at the bottom of your page which logins everytime.

Related

ASP Classic: twitter and facebook autoposting without signing in

In work I got a task (we MUST work with ASP Classic by the way): when user posts a blog, a link to that blog should be posted automatically on user's facebook timeline and in his twitter. I made everything working, but there is one problem: user needs to be signed in to post. I've made the cheking if he's logged in, and if not he must log in.
But I need to avoid the logging-in step and make it automatic (by sending user's username and password as part of the data sent to twitter/facebook or something like that), but I can't figure out how to do that or if it's even possible at all.
Any ideas? Would greatly appreciate any help.
P.S.: for the twitter part I used http://scottdesapio.com/VBScriptOAuth/
for the facebook part I used a combination of: http://snipplr.com/view/61108/facebook-app-login--authorization-entirely-clientside/
Everything works, but is it possible to automatize the user's sign-in part?
Finally I managed to make the both things automated...
The problem with Twitter was that I didn't store request token in session, that's why I got "Could not authenticate you" error.
Can't remember what I did wrong with Facebook (some co-workers helped me out), but I guess I didn't make proper http requests...
So the answer is: yes, it is possible to automatically post to Twitter and Facebook without user sign in.
If I am not wrong then your logged in user in facebook for current browser is not authorize for your app.
I think you should try googling about "How to authorize users into app". OR
If you don't mind I am giving you the direct URL to go to that setting page for your app:
https://developers.facebook.com/apps and then go to your app then after from left side bar go to roles and then after click on test user tab from top of page and then click on add button it will opne one pop-up to add a user.
In app you have to add test user for testing purpose and have to login for that added test user, so added user will be authorize for that app and you will be able to test.
Thank you...

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.:/

facebook logout without sdk

How can I log out user from facebook without authorizing him myself?
I have a public IPad which people come to, authorize in my application and do stuff.
One of the links leads to m.facebook.com/sharer.php?u=..
When the user presses it, he is redirected to facebook, which asks for his login/pass and makes the share.
Later then the user press Logout on my site
I need to log out him from facebook some way,
so the next user who will use the ipad and press share will post to his wall and not to the first user's .
Same happens when i provide the iframe version of the Like button.
The first user logs in to facebook, makes the like, logs out of my web site,
and the next user see the like button pressed.
Thanks in advance ;)
I've just done some work with facebook recently on one of my projects and I used to visit a url to log them out it was something like
http://www.facebook.com/logout.php?redirect=your_url
It may not exactly be that as its off the top off my head but after visiting that the user got redirected to my site again logged out of facebook.
You may also have to provide a token.
Hope this helps!

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

Authenticate to Facebook without Clicking Facebook Connect Button

I have added Facebook Connect to my application via the JavaScript SDK. I'm using Spring Security (this is a grails app) and I have added code that when someone clicks the FB Connection button to login, I manually authenticate them against their user account and everything gets wired up appropriately. I have 2 questions:
When a user first logs in with FB and I don't have an account for them, I create an account for them with their FB info, generate a random password, and use their email for their login name. If the user then uses the regular login form instead of the FB button to sign in, how do I sign them in to FB as well?
Every time the user clicks the FB Connect button, the popup window shows up. If they are already authenticated, it just goes away and then my web site redirects correctly. How do I keep the popup window from showing up in this case?
Thanks
To you first question, the user might be connect on Facebook when landing on your page after registration. So you can rely on the Javascript SDK to help you out.
See here: http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus
To your second question, I think you can't, except you might get a work around if you use the Javascript SDK mentioned for the first question!
This is how I did it for moviezine.se and it works just fine, but it might be a little irritating to be logged in without asking for it when you come back a few days later. Then there is the use case of the logout: if you are automatically logged in, are you automatically logged out too; and if not, what if your Facebook session is replaced by your girlfriend's one who is also a user on your site! :)