Note that there are some explanatory texts on larger screens.

plurals
  1. POGet current facebook users id
    primarykey
    data
    text
    <p>I'm trying to get the current facebook user for a silverlight game that is not hosted in a .NET page, just an html page. The silverlight game will use their id as a credential for submitting a highscore.</p> <p>I don't want them to login to Facebook using my app. I want them to login to facebook outside of my app. Then my app checks using .Get("me") of the Graph API. However, .Get("me") always returns null. Even if the facebookClient has an App access token or appid+secret.</p> <p>I'm using the C# facebook sdk version 5.4.1.0 (for SL4 support).</p> <p>This is how I try to do it using appid+secret:</p> <pre><code> var app = new Facebook.FacebookClient(appId, appSecret); app.GetCompleted += new EventHandler&lt;Facebook.FacebookApiEventArgs&gt;(app_GetCompleted); app.GetAsync("me"); } void app_GetCompleted(object sender, Facebook.FacebookApiEventArgs e) { //the value of me below is always null var me = e.GetResultData() as IDictionary&lt;string, object&gt;; string id = (string)me["id"]; } </code></pre> <p>According to other sites the Apps access token should be more than enough to get the id of the current facebook user:</p> <ul> <li><a href="https://stackoverflow.com/questions/10094652/facebook-c-sharp-sdk-get-current-user">Facebook C# SDK Get Current User</a></li> <li><a href="http://developers.facebook.com/docs/reference/api/user/" rel="nofollow noreferrer">http://developers.facebook.com/docs/reference/api/user/</a></li> <li><a href="https://stackoverflow.com/questions/4730468/facebook-c-sharp-sdk-does-the-facebookapp-getme-access-to-facebook-or-just">Facebook C# sdk - Does the FacebookApp.Get(&quot;me&quot;) access to Facebook or just to cookie?</a></li> <li><a href="https://stackoverflow.com/questions/5240935/what-is-the-best-way-to-get-the-userid-of-the-current-user">What is the best way to get the UserId of the current user</a></li> <li><a href="https://stackoverflow.com/questions/5171309/facebook-c-sharp-sdk-and-access-token">Facebook C# SDK and Access Token</a></li> </ul> <p>What am I doing wrong/misunderstanding to get the current facebook users id?</p> <p><strong>Edit:</strong> debug info</p> <p>Fiddler2 result 404:</p> <pre><code> "message": "(#803) Some of the aliases you requested do not exist: clientaccesspolicy.xml", "type": "OAuthException", "code": 803 </code></pre> <p>Fiddler2 result 400:</p> <pre><code> "message": "An active access token must be used to query information about the current user.", "type": "OAuthException", "code": 2500 </code></pre> <p>FacebookApiEventArgs e.Error.Message:</p> <pre><code>Value cannot be null. Parameter name: stream </code></pre> <p>FacebookApiEventArgs e.Error.StackTrace:</p> <pre><code>at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen) at System.IO.StreamReader..ctor(Stream stream) at Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, Stream responseStream, Type resultType, String&amp; responseStr, Exception&amp; exception, Boolean&amp; cancelled) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload