Javascript - Best Practices For Facebook Integration Using The Graph API
Mar 27, 2011
When it comes to integrating your site with facebook, is it recommended to save all the user's info from Facebook to your DB, or is it recommended to query in real time all the info you need based on the user's id?
For example the avatar sizes are different on my site than on my facebook, so I may have no choice but to download the fb avatar, but for other things like name, gender, hometown, I was wondering if I need to save that data. Also, if I decide to change extended permissions at a later time, is that going to be an easy task?
View 1 Replies
Similar Messages:
Sep 17, 2010
I am using facebook graph Api for my application where i want the data of this page.
http://www.facebook.com/pages/
In this page there is option TV SHOW I want collect all information of that page.
But i didn't any graph api method for this page.
View 1 Replies
Mar 26, 2010
I like to send messages when I want from my aspx webpage. I used the different examples and used FaceBook API 3.1. I am getting error as "service temporarily unavailable". I have assigned AppKey, Secret Key and session key. My sample code is below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
using Facebook.Web;
using Facebook.Rest;
using Facebook.Session;
using Facebook.Utility;
using Facebook.BindingHelper;
using Facebook.Schema;
using Facebook.Web.FbmlControls;
using Facebook.Session.DesktopPopup;
namespace FaceBookApp
{
public partial class _Default : System.Web.UI.Page
{
private const string ApplicationKey = "MY_APP_KEY";
private const string SecretKey = "MY_SECRET_KEY";
private Api fbAPI;
private ConnectSession _connectSession;
// private List<EventUser> _eventUsers;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
_connectSession = new ConnectSession(ApplicationKey, SecretKey);
_connectSession.SessionKey = "MY_SESSION_KEY";
if (!_connectSession.IsConnected())
{
// Not authenticated, proceed as usual.
//lblStatus.Text = "Please sign-in with Facebook.";
}
else
{
// Authenticated, create API instance
fbAPI = new Api(_connectSession);
string response = fbAPI.Stream.Publish("publish steven on facebook.");
}
}
}
}
The error message is confusing. It must be a very simple solution. I don't know what I am missing. Here is the facebook exception.
{"Service temporarily unavailable"}
View 1 Replies
Feb 16, 2011
i'm using Facebook C# SDK i can get my friends like;
JsonObject friends = (JsonObject)facebook.Api("me/friends?");
But i couldn't get my friends which uses my application how can i get them?
View 2 Replies
Feb 28, 2011
I have this requirement of fetching facebook user information like friends count and other basic information and integrate to our website.
I currently use facebook graph to ask user to authorise, fetch information and store in my database.
When their say, friend count changes how do I update my database without asking user to trigger it manually.
Is there a special permission where i can fetch user data when he/she isnt logged in.
I have seen this somewhere but not sure of the permission.
Or does facebook have any feature of publishing information on subscription ?
View 2 Replies
Jul 20, 2010
i want to use localhost for developing website facebook application using the graph api.
i working in asp.net c#
in the previous api of facebook i was abe to write the
http://localhost:4300/ in the connect url at the application settings.
now it dosent work.it keeps telling me
An error occurred with application name. Please try again later.
** if i upload the website, and use the website coonect url, it is working.
View 3 Replies
Mar 17, 2011
I am tying to get the work information from a facebook user using Graph API
When I use the Graph API and get the User object, it contains work information, which is essentially a list of the work history. The list elements contain nodes of employer, location, description, etc...
The FQL return it as a JsonObject, how do i get the the value employer out of it. I am only interested in the last employer. I tried something below but could not get it working.
[Code]....
There is more information that says it return the "work_history" as an array
http://developers.facebook.com/docs/reference/fql/user/
View 7 Replies
Mar 27, 2011
i wrote an application for facebook but i couldn't upload image to album that i created,
code is in below
Facebook.FacebookAPI api = new Facebook.FacebookAPI(GetAccessToken());
Dictionary<string, string> album = new Dictionary<string, string>();
album.Add("name", "Test Album");
album.Add("message", "Message here!");
JSONObject result = api.Post("me/albums", album);
string AlbumId = result.Dictionary["id"].String;
Dictionary<string, string> photo = new Dictionary<string, string>();
photo.Add("message", "test Message");
photo.Add("source", "tgw.jpg");
JSONObject photoResult = api.Post("/" + AlbumId + "/photos", photo);
View 1 Replies
May 17, 2013
I am following your code for integrating facebook authentication.
It really works fine, but as per your post at [URL] ....
We cant use dll to logout from facebook. Is there any way around or do we need to use use facebook sdk for just logging out?
View 1 Replies
Dec 31, 2013
i want a code to search a friends and send a request (add to my friend)
View 1 Replies
Nov 10, 2010
We're thinking of making use of the Facebook Live Stream social plugin for our site (example here), but I wanted to know if it was possible to access this data via the Graph API?
View 1 Replies
Jul 14, 2010
I try to get parse JSON response for the following link:
https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token=
The response is like that:
{
"135395949809348": {
"data": [
{
....Some data
}]
}
,
"325475509465": {
"data": [
{
....Some data......
}]
}
}
I use System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(string json) method.
But the objects key names always different , so I can't define the class that can be used for parsing this response.Is anyone has any experience in parsing multiple id's response from Facebook?
View 2 Replies
Jul 26, 2010
I've integrated my website with Facebook Connect, authorization/single-sign on all working great.
Now im trying to post something to the user's wall, which im having some problems with.
First of all, im using the "old" JavaScript API (FeatureLoader.js).
These are the Graph API URL's im using:
private const string UserDetails_Url = @"https://graph.facebook.com/{0}?access_token={1}";
private const string Feed_Url = @"https://graph.facebook.com/{0}/feed?access_token={1}";
private const string TokenExchange_Url = @"https://graph.facebook.com/oauth/access_token?{0}";
I'm using the TokenExchange_Url URL to receive the unique user OAuth token to make calls with.
This is working fine, because a) i receive the token back, and b) i can issue HTTP Get Requests to the Graph API (i.e UserDetails_Url) and it works fine.
But, i cannot Post to the User's wall using the Feed_Url.I'm pretty sure the issue is i haven't got the appropriate user permissions to post to a wall (i.e facebook-side setting).
Now, i realise i can use the fbPublish API method client-side to do this, but i want to do it server-side with the Graph API.
I wont bother showing my code which attempts the call to the Graph API to post to the user's wall, as its pretty straightforward (HttpWebRequest, set method to "POST', set content type/length, write bytes to Stream, etc).
I think the problem is i need the user to grant my aplpication "publish_stream" extended permissions.
The Facebook Graph API doco says to do this in your authorization request:
https://graph.facebook.com/oauth/authorize?
client_id=...&
redirect_uri=http://www.example.com/callback&
scope=user_photos,user_videos,publish_stream
Which confuses me because im using the following URL to get the OAuth token:
https://graph.facebook.com/oauth/access_token?bunchofqsparams
Am i using the wrong Token Exchange URL? Why is there two different URL's to seemingly get the same piece of information?
Yes - i have read the Facebook API doco (numerous times), and yes i have read other similar SO questions, but they all result in using the client-side API to publish to wall, i want to do it server side.
For the actual "Facebook Connect" button, i'm using the standard FBML:
<fb:login-button length="long" size="medium" autologoutlink="false" background="light" onlogin="facebookLogin('/login')" class=" fb_login_not_logged_in FB_login_button FB_ElementReady"><a id="RES_ID_fb_login" class="fbconnect_login_button"><img id="RES_ID_fb_login_image" src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif" alt="Connect"></a></fb:login-button>
When i click this (and not logged into Facebook), it pops up a window which the user can login. But it doesnt have the "Request Extended Permissions" dialog - shouldnt it? Or is that another popup i need to manually trigger?
So to sum up, here are my questions:
How do i grant extended permissions to publish to the user's wall?What is the correct URL for obtaining an OAuth token?Is there a definitive source for showing how to post to a user's wall using server-side Graph API calls?
View 1 Replies
May 7, 2015
Regarding your facebook api in aspsnippets, and the article [URL]..... , I can get the facebook user id, name, email, gender, birthday. But I cannot get UserName. When running website, the lblUserName is blank.
View 1 Replies
Dec 26, 2013
I have two friends in facebook
the name of the first friend is : jad .
the name of the second friend is :rima .
How I can get the mutual friend list between jad and rima .
View 1 Replies
May 7, 2015
How can retrieve Phone numbers from Facebook API.
View 1 Replies
Dec 25, 2013
How to use read_mailbox function to use to fecth the user data..and Provides the ability to read from a user's Facebook Inbox. in asp.net c#.. I am using aspsnippet namspace in my project..
View 1 Replies
Apr 29, 2012
I am developing an ASP.Net site where I need to access Facebook site. I want to know how can we register and get API key...
View 1 Replies
Nov 16, 2013
This tutorial nice. Here I have one problem..that is how can i get Code value... In pageload
string code = Request.QueryString["code"];
View 1 Replies
Nov 15, 2012
how to post feed OUR wall. now, my friend wall, using their ID.tried with
FaceBookConnect.Post(ViewState["Code"].ToString(), "/<friend ID>/feed", data);
--> failed :-(
FaceBookConnect.Post(ViewState["Code"].ToString(), "/<friend ID>/notes", data);
--> also failed
also tried with : "/<friend ID>/notes" which also failed.
View 1 Replies
Jan 3, 2014
i want a code that i can get the list of friends want to add me in facebook . i want to accept the add or refuse
View 1 Replies
Jan 22, 2013
I was implementing codes taken from[URL] .... and [URL] ....
It works fine separatly but when i want to integrate it gives me an error "Bad Request......"at so how can i get user info and his friend list on login button.
protected void Login(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,email,friends_photos", Request.Url.AbsoluteUri.Split('?')[0]);
}
protected void Page_Load(object sender, EventArgs e)
[Code] ....
View 1 Replies
May 7, 2015
i have made a gridview which contains three fields, two textboxes and one combo box. ComboBox fetchs data from table(SQL) and when a combox box triggers, data related to combo must be added in two boxes. i did this throw another button, but i want this to be trigger directly when it clicks..
View 1 Replies
Nov 16, 2013
I'm writing applications on Facebook located on an external website ASP.NET C #. The application should check whether or not a person likes my Fan Page (page) on Facebook, and if he or she doesn’t like it needs to like it before using this application. How this can be done using the Graph API and ASPSnippets Facebook API.
View 1 Replies
Jan 25, 2010
I would like to know what are the best practices in using Javascript in ASP.NET in a pre-AJAX and pre-jQuery era. What I meant by pre-era is not the time before AJAX/jQuery was created, but rather the time before it is popularized and widely adopted (by a significantly large number of programmers).i.e. Is it good thing to store the script in a string variable and register it on demand (RegisterClientScriptBlock) or on startup (RegisterStartUpScript)?Although in using Javascript in ASP.NET, its usage in PHP and JSP are also welcome.
View 1 Replies