0

C# コンソール アプリを使用して単純に Facebook グラフに接続しようとしていますが、FacebookOAuth 例外が発生しています。これまでの私のコードは次のとおりです。

       var client = new FacebookClient();

        // Exchange the code for an access token

        dynamic result = client.Get("/oauth/access_token", new
        {
            client_id = "****************",
            client_secret = "*****************************",
            redirect_uri = "http://www.teamdavix.com",
        });

        // Read the auth values
        string accessToken = result.access_token;

        DateTime expires = DateTime.UtcNow.AddSeconds(Convert.ToDouble(result.expires));

        var query = "SELECT author_uid, page_id, message FROM checkin WHERE page_id = 357981198572";

        dynamic parameters = new ExpandoObject();
        parameters.q = query;
        dynamic results = client.Get("/fql", parameters);
        Console.WriteLine(results);
        Console.ReadKey();
4

1 に答える 1

0

You have to use https://www.facebook.com/connect/login_success.html as the redirect_uri from desktop applications. The information from a successful login will be passed as url fragments (after a #) in the url. If there is an error it will be passed as query string parameters (after a ?) in the url.

http://www.hackviking.com/2014/11/facebook-api-login-flow-for-desktop-application/ - complete example how to implement a login flow from a desktop application.

https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.2 - more information about how to build your own login flow.

于 2014-11-11T21:34:30.730 に答える