开发者

How to use Facebook authentication return "session" parameter?

After successful authentication, Facebook redirects me to the canvas callback url with the parameter installed and session. the session parameter is like this...

    &session=
{%22session_key%22%3A%222.cQWUqNcffzsWReDAcctOmA__.3600.1281524400-1000开发者_JAVA技巧00327994753%22%2C%22uid%22%3A100000327994753%2C%22expires%22%3A1281524400%2C%22secret%22%3A%22xOodxtnGGNMIK0F4Zq_sCw__%22%2C%22sig%22%3A%223eb5b89dd11e3b42d46587921ebecc52%22}

after decode it looks like

&session={
    "session_key":"2.cQWUqNcffzsWReDAcctOmA__.3600.1281524400-111111327994753",
    "uid":111111327994753,"
    expires":1281524400,
    "secret":"xOodxtnGGNMIK0F4Zq_sCw__","
    sig":"3eb5b89dd11e3b42d46587921ebecc52"}

Now the prblem is that I have no idea that how i use this parameter in C# SDK. I want to get permission and also want to get auth_toke.

In FB's documentation, "accesstoken" and "auth_token" are used. Are they the same or different?


I'm not a C# guy, but the session parameter is just JSON - and there appears to be a plethora of ways to parse JSON in C#.

In regards to the phrases "access token" vs "auth_token" - could you provide links to two FB documentation pages that use each term?


Check out the Facebook .Net SDK on Codeplex http://facebooksdk.codeplex.com. It will handle all the 'dirty work' for you. For example, I could call the following code either from a controller action or on Page_Load.

FacebookApp app = new FacebookApp();
string accessToken = app.Session.AccessToken;
long userId = app.UserId;

Thats it. You don't really need to worry about how facebook is returning the data to you. The SDK handles all that for you.


Try this out,

String Session_Key=Request.QueryString.Get("session_key");

long User_Id=long.Parse(Request.QueryString.Get("uid").ToString());

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜