– Ben Martens

Facebook SDK Changes

I have a little custom C# app on my Windows phone that posts photos to Facebook and my blog at the same time. Today it seemingly randomly stopped working. The login code ended in a page that said “SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anyone.” The app stopped there because it couldn’t find an OAuthToken on the response. This was one of the few times that a search failed me so I thought I’d give back and hopefully help someone else stuck in the same spot. Here’s the fix I ended up with:

  1. Update to version of the Facebook SDK (released today)
  2. Update login code to something like this:

private void LoginToFacebook()
    var parameters = new Dictionary<string, object>();
    parameters["client_id"] = _appId;
    parameters["redirect_uri"] = "";
    parameters["response_type"] = "token";
    parameters["display"] = "touch";
    parameters["scope"] = "publish_stream";

    var navigateUrl = _fbClient.GetLoginUrl(parameters);


private void FacebookLoginBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
    FacebookOAuthResult oauthResult;
    if (!_fbClient.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))

    if (oauthResult.IsSuccess)
        App.OAuthAccessToken = oauthResult.AccessToken;
        _fbClient = new FacebookClient(oauthResult.AccessToken);
        _loggedIn = true;