1

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.

Eslam Soliman
  • 1,276
  • 5
  • 16
  • 42
Odisea2
  • 11
  • 5
  • Is there a way to find out if they are an app user already? I basically want to allow browsing of my app and if they want to do more then I'll ask for permissions. I don't want to discourage users with permissions until they have checked some open stuff on my app. – Odisea2 Mar 09 '11 at 04:39
  • well you can save the user id in DB and when the user login check if the user stored or not ,another thing you have to popup the user ti accept permission you can minimize the number of permissions but you can not cancel it – Eslam Soliman Oct 14 '12 at 06:19

2 Answers2

1

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"];
Eslam Soliman
  • 1,276
  • 5
  • 16
  • 42
0

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.

yulun
  • 260
  • 1
  • 6
  • 21
  • This is strange, since you can do this with the javaScript SDK from FB http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus is there a reason why they don't let you do this from the SDK? – Odisea2 Mar 09 '11 at 05:49
  • you can't get the user id from the javascript sdk without making them allow your app..... you can only get the user id after doing this [FB.login](http://developers.facebook.com/docs/reference/javascript/FB.login/) – yulun Mar 09 '11 at 08:09
  • you are right, I can't get the user id, but I can tell if they are a user of my application, which is what I really want (getting userId was just one way for me to check against my DB). So, is there a way with the SDK to tell if this user has my app in FB just like this javaScript FB.getLoginStatus does? – Odisea2 Mar 09 '11 at 16:58
  • No, you can only tell if a user has ur app when they allow your app. – yulun Mar 10 '11 at 06:55