Reputation: 11
How to get Face Book Current UserId . I would like to avoid asking for permissions since my users are just browsing and i only want to see if they have done this before.
Upvotes: 1
Views: 2222
Reputation: 1296
using Facebook c# sdk:
string signedRequest = Request.Form["signed_request"];
var DecodedSignedRequest = FacebookSignedRequest.Parse(Facebook.Web.FacebookWebContext.Current.Settings.AppSecret, signedRequest);
dynamic SignedRequestData = DecodedSignedRequest.Data;
accessToken = (String)SignedRequestData.oauth_token;
var app = new FacebookWebClient();
var me = (IDictionary<string, object>)app.Get("me");
firstName = (string)me["name"];
U_Id = (string)me["id"];
Upvotes: 1
Reputation: 260
As far as i know i don't think there is a way to get the UserId of the current user without asking for permissions.
If you look at the guide for signed request parameter, it does not return the userid until the user has allowed your application basic access.
Upvotes: 0