I'm a new Facebook developer. I'm creating a game and want to include a leader board.
I'd like to build a fairly detailed leader board including the following information:
1) Name
2) Pic_Square or profile_pic
3) A general location (UK, USA or LONDON, NY)
4) Score
I'm aware of how to get a current users basic information from the either the old REST API or the Graph API. However from what I understand of the Facebook rules I can't store the information I want to use from the API.
This leads me to the conclusion I should be polling the Facebook API using the information I can store (FB user ID's). When querying the API for specific user ID's (the ones for the test users I have generated) API methods (user.getInfo and fql.query) return either just the ID of the user or the fields I have requested with null values.
When querying my own ID I can access all the data.
Are there any methods to obtain publicly available data via the any of the APIs?
Thanks for your help!
Ben
Why do you think that you can't store this info? On the user table page it even says:
You can cache this data and subscribe to real time updates on any of its fields which are also fields in the corresponding Graph API version.
If you request offline_access permission you would be able to get user information even when a user is not currently logged in to your app.
You should be able to get any user public info without permissions or access token by going to:
https://graph.facebook.com/<USER_ID>
To display avatar you can use this code:
<img src="https://graph.facebook.com/<USER_ID>/picture"/>
I don't think you would be able to get location without requesting extra permissions.
Related
What I'm trying to do is implement a "log in with Facebook button" on my site. I think I have understood most of the Facebook JS API, yet I am not certain of how I securely can tie information in my own databases up against a Facebook user. My current theory is:
1. Register Facebook's UID for the user in database for further reference.
2. Tie all further information from the user (the infromation inputted by the user in the application) up to the user ID after verifying the Facebook access token (in the backend), to prevent user from adding/removing information on behalf of another user.
3. When the user makes a query for information, you verify the access token issued by the JS API in your backend up against Facebook's APIs before returning any information related to the user, to prevent the user from spoofing his own ID
Side note: Not sure if Stack Overflow is the correct place to post this question.I know that there is an enormous number of sub sections on Stack Exchange. If this isn't the place then let me know :)
I implemented a login with Facebook module in my recent node project. When the user logs into Facebook successfully, it usually returns a unique Facebook ID (along with a lot of other data). You could then create a relation table in your database that relates the unique Facebook ID with a special user ID for your site.
If you have facebook info you are going to need frequently like profile image... I would grab the url every time and store it in a session variable when the user logs in simply because it can change.
I'm developing an application that uses the LinkedIn API (and other social networks') to retrieve the messages you receive in yout timeline and get other user's information.
I know that I can't get that information over a user since the last API update thay made, but I'd like to know if that's possible from a company page. I can get the updates I've made on the page and my user profile but what I want is to get the user's profile from a person that makes a like in one of my publications (to put and example).
Is that possible like with the Facebook API and Twitter API or I can only access to information from the user that is authenticated in the application?
Thank you.
In general, only You can get that information with authenticated users in the application.
As for LinkedIn, I don't know if you know that from May 12 (if I remember correctly) LinkedIn API is changed.
Changes in Linkedin API
In numerous applications I've written, every time I want to give user an opportunity to log in through Facebook, I get their user id after logging in and pair it with my app's user account. However, after an introducion of v2.0, I'm not pretty sure how should I pair them. If I upgrade now without making any changes but changing API endpoints, I end up with duplicate accounts due to inconsistency between User IDs (I'll be searching for a new (APP scoped) used id in database with old IDs). How should I upgrade without losing every user consistency?
To demonstrate how do I retreive their accounts, I'll join a bit of PHP here
<?php
$user = $db->fetchQuery("SELECT * FROM users WHERE fb_id = ".$facebookSDK->getUser());
Consistency should be fine here, within a single app.
If a user has already authenticated with an app prior to 4/30/2014, the id you receive will not change. For new users authenticating on or after 4/30/2014, you'll get an 'app-scoped' id which has the same format but is not the canonical 'fbid'.
For apps owned by the same developer, the Business Manager can provide mappings for users across app-scoped ids in different apps.
https://business.facebook.com/
There is a dirty hack to retrieve original facebook id
http://graph.facebook.com/app-scoped-id this returns facebook public informaton along with username
Then you make another graph api call with username
http://graph.facebook.com/username
This will returns the original facebook id and other public information, instead of app-scoped-id
I'm working on a social hub page which aggregates info from all social networks. Currently I'm trying to fetch infos from one specific foursquare venue.
To get the information I want, I have to use an access token and therefore authenticate my user. In my case this would always be the same (my own) user.
Is there a way to get an access token with my username/password without having to redirect to the authentication page?
I couldn't find any answers here so far, thanks for your help!
Update:
I just discovered exactly what I want to implement on http://de.puma.com/creativefactory - if you scroll down you can see foursquare information on the bottom right corner, that's exactly what I want: Display how many users checked into my venue and the last persons who checked in. How did they do that, there is no auth dialog required? Thanks again!
Unfortunately, this is explicitly not allowed for security reasons. Although it may seem safe in your case, we don't generally want to support 3rd-party applications handling our users' passwords when OAuth makes it unnecessary. This is the same policy that many other large social networks have.
If you're just looking for venue information (e.g. just information about a venue and NOT any user information) then you don't need to have an authorized user. The venues API can be accessed with only your client ID and client secret. See the Foursquare API documentation..
Some of our endpoints that don’t pertain to specific user information,
such as venues search are enabled for userless access (meaning you
don’t need to have a user auth your app for access). To make a
userless request, specify your consumer key's Client ID and Secret
instead of an auth token in the request URL.
You should be able to get the required information without user authorisation.
Just create an app and you will be provided with a client id and client secret, you can then use these to access the API.
Here is the required venue API string format:
https://api.foursquare.com/v2/venues/[VENUE_ID]?client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&v=20120101
In the returned json you should find:
"hereNow":{"count":x,"summary":"x people here","groups":[]}
I am integrating GFC with my web app (PHP). In this app I have a list of user IDs and I need to fetch their profile details like their display name, profile pic url etc. using a HTTP call.
For example, I am trying to fetch data of user with id: $userId = 1234567
If a viewer (need not the user with above id) is logged in, I am able to fetch data by making a call to following URL.
http://www.google.com/friendconnect/api/people/$userId/#self?fcauth=$fcauth
But, if viewer is not logged in, the above URL replies the following
Anonymous requests are not allowed to fetch data
Error 401
I would like to know what URL should be used to fetch the user data even if no one is logged in.
Thanks!!
The fcauth mechanism is designed for access while the user is online. The fcauth tokens expire fairly rapidly, and no guarantee is made about how long they're valid for. You should assume that they'll only work while the user is online.
If you need offline access, you need to use OAuth. OAuth tokens are valid until manually revoked.
The API call you're making is the correct one, you just need to do it with OAuth instead of fcauth.