Populating Test User with Check-in data - facebook

How do you populate a Facebook Test User account with check-in data? I tried posting on the wall of the user with a Location entered in, but that did not seem to trigger a "check-in". Anyone run into this issue?
The only workaround I've found is to use a real user account.

Have you tried logging in as the user, using the email and password provided when you created the user?
I've only worked with photos, but I've had luck with using the normal user interface for these kinds of tasks.
Also, you have to be careful to keep using the same user. The access token expires, so you have to renew it with the same user ID. I was accidentally creating new users.

Related

What is needed to access another user's facebook posts ("App Not Setup")

I have a desktop app which uses a user access token to read the me/feed endpoint and I can see all the posts for the logged in user. If I wanted to simplify deployment to different users I would need to minimise the amount of setup/configuration they did.
Is there a way to access me/feed for a given userid rather than have to setup every user as a developer account and create an app for it?
I have looked at https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0 and it is not obvious to me how to do this.
What configuration / permissions does the user in question need to do to activate this. Which access token should I be using, and will it give access to all the posts in the same way the user access token does.
[EDIT] I have looked at this again and the problem I am having is that when a user (who has a facebook account but is NOT a developer) tries to login to my App (which is in development mode) I get the following error
"App Not Setup: The developers of this app have not set up this app properly for Facebook Login."
Thanks in advance

Facebook Login in Website - How to Cross Validate

How does my website know when users are logging in with their facebook account for the first time - so that if they arent registered with me i can then create the same.
I think to know the first time user logs in with facebook would have to be controlled on your side.
You'll want to build some sort of logic to store the user's FB info like FB UID and email perhaps, in your DB when they login through FB. Additionally, you'll want to do a lookup for the user's UID and email in your DB on each time the user logs in through FB.
You might also want to consider if the user ever decides to "disconnect" their account from FB / revoke access to your app through FB. In this case, you'll want to remove their UID and email from the DB since they've chosen to revoke access.
If they decide to come back, then treat them as a new user and repeat the steps above.
A majority of your code will be checking the response from FB.getLoginStatus https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
You can experiment with FB.Event.Subscribe and 'auth.authResponseChange'.
Check the documentation

facebook register/login

I'm trying to implement facebook connect to my website, and i have couple questions.
1: Is it possible to register user in my website using his current facebook email/password.
Let's say user clicks on link Register via facebook and then he have to give me permisions to access his password, email, etc... and after that is done i put that info in my own database and he will be able to login with that account any time he wants without needing to give me permisions any time in the future.
2: If that kind of registration is not possible, what's other solution would be the best for me? Because i need to somehow keep track of that user who logged in with facebook, because he can upload photos, send messages etc.
Anyways, i'm quite new with facebook and similar things, so i'm really lost here, hope some one can help me :)
EDIT Thank you all for wonderful answers it helped me a lot, now all that's left is to read documentation :)
Yes it is, it is possible to get the information of the user. But it is rather complicated, when you have never dealt with it.
First you need to send the user to the following link:
https://m.facebook.com/dialog/oauth?client_id=your-client-id&redirect_uri=xxx&scope=listof-information-you-want
Facebook will then return your client to the uri specified, if the user rejected it will give a reason. If it is not you will get an code in urlencoded format.
This code is needed for the following step, the request of the access token:
https://graph.facebook.com/oauth/access_token?redirect_uri=xxx&client_id=xxx&client_secret=xxx&code=xxxx
This will give back an access token, if the authorization didn't fail.
After that you can ask for the information you want:
https://graph.facebook.com/me?method=GET&metadata=true&format=json&access_token=access_token
This will include a facebook uid, which is unique for all users. Store it and you can discern between a register and login.
This is roughly the process for any oauth2 application.
Facebook will not ask repeatedly for permissions after the user granted them to you. So you can store the access token and reuse it for backend stuff and also use the same procedure you use for register for login.
You can never access the user's password from Facebook even with his/her permission, so the user will always have to authenticate via Facebook and have Facebook pass you the user id of the logged in user once authentication succeeds. You can store all kinds of other data locally, but not enough to authenticate the user yourself.
Once the user is authenticated, you'll have access to the user's Facebook user id via the API, which should be enough to connect all kinds of information to that specific user.
Facebook does not provide access to accounts when passwords are taken from your controls. It provides it own canvas for login information. Therefore you cannot use your first approach to store passwords in your databases. Check this out.
You can however store email addresses once user logins into his account using the facebook sdks. Check this out link for the example of C# SDK sample code.
You can use the Facebook APIs to fetch user email-id, photos, friendslist and other information and then play around accordingly.
You don't get access to the users password - only email if you ask for it.
Best way would be to have a table of users and their Facebook account id's.
If you want to allow users to sign up without Facebook then have a nullable field for their password and facebook id, and also have a field for username - which you could populate from Facebook if they register via that route.

How long can I access a friend's list offline after that person connects via facebook connect?

I want be able to send a list of friends & recent additions from someones facebook account to an email address daily or weekly.
Looking up online, I think the best approach would be to setup a website, where a user would facebook connect with their facebook credentials & accept all terms including accessing their friends list. The website would then run a batch job nightly to access that persons friend list, do a matchup and then send an e-mail with the summary of their findings.
Is this possible? Can I just do a onetime login and get forever access to someones friend list, assuming they do not manually revoke access to the application within fb? looking for suggestions. I know there is way to access a profile offline, but how long is that session available for? I know the policy has changed, AND can change in the future by trying to understand the current state of accessing a friends list offline.
Also, am I violating any policies by doing this?
You need to ask the user for an offline_access permission and read_friendlists permission, that way you'll get an accessToken that does not expire.
More info here: http://developers.facebook.com/docs/authentication/permissions
as long as you don't save data you'll be fine

How to use Facebook connect to login in to my database?

I have a mysql membership database run by a Perl script. Account creation or login requires an email address and password. The Perl script then sets cookies (password cookie has encrypted value) which allow users to create, own and modify records. A members table contains user information. I've gone through the FacebookConnect information as well as the forum. Maybe I cannot see the forest for the trees, or maybe this is not possible. In order to use FacebookConnect for logins/account creation, I need to be able to send the user email and password to the the Perl script so that the proper cookies are set. If it were an http it would look like this:
http://domain.com/cgi-bin/perlscript.pl?_cgifunction=login&email=ddd#somedomain.com&password=somepassword.
Any hints or advice would be greatly appreciated.
What you are trying to do isn't really possible in the way that you're describing it.
Facebook Connect basically provides you with a single piece of information: whether your visitor is logged in to their Facebook account or not. If they are, you can get their Facebook ID, if not, you can show them a button (or whatever) and ask them to log into Facebook.
Generally a good approach when using Facebook Connect as an authentication method for your site is to have an internal id for the user's member account, and store a user's Facebook ID alongside that. When a user comes to your site, and they are already logged in to Facebook, you just use their Facebook ID to retrieve the local account. Otherwise you show them your login form to log in locally, and/or a Facebook login button.
The problem you're running into here is that you cannot get someone's email address from Facebook, as it is purposely hidden to protect privacy. If your membership scripts provide only the email/password log-in method, then what you need to do is modify these scripts to create the authentication cookie when given a properly authenticated Facebook ID.
Essentially you'll have two login functions... one for a Facebook login, and one for a regular login. Either function should properly created the local authentication cookie.