Facebook Developer ToolKit: How should I construct this app?

Posted by j0nscalet on Stack Overflow See other posts from Stack Overflow or by j0nscalet
Published on 2009-12-06T05:42:54Z Indexed on 2010/05/22 10:00 UTC
Read the original article Hit count: 564

Filed under:
|
|
|

I have created a simple desktop application that I want to use to post status updates for the users of my app. Here's the kicker though that I am having trouble figuring out, the desktop application runs as part of a batch process every night, in which I update the status of certain users.

I use the following code to accomplish this: (comes directly from the FDK samples)

    public FriendViewer()
    {
        InitializeComponent();
        facebookService1.ApplicationKey = "Key";
        facebookService1.Secret = "Secret";
        facebookService1.SessionKey = "Session key";

        facebookService1.IsDesktopApplication = true;


    }

    private void TestService_Load(object sender, EventArgs e)
    {
        try
        {
            if (!facebookService1.API.users.hasAppPermission(facebook.Types.Enums.Extended_Permissions.status_update))
                facebookService1.GetExtendedPermission(facebook.Types.Enums.Extended_Permissions.status_update);

            if (!facebookService1.API.users.hasAppPermission(facebook.Types.Enums.Extended_Permissions.offline_access))
                facebookService1.GetExtendedPermission(facebook.Types.Enums.Extended_Permissions.offline_access);
            long uid = facebookService1.users.getLoggedInUser();

            facebook.Schema.user user = facebookService1.users.getInfo(uid);
            facebookService1.users.setStatus("Facebook Syndicator rules!");
            MessageBox.Show(String.Format("Status set for {0} {1}", user.first_name, user.last_name));

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            Close();
        }
    }

My user's day to day activity is done a website front end. Since I dont have any user interaction in a nightly batch process, I cannot use the ConnectToFaceBook method on the FaceBookService to obtain a sessionKey for the user. Ideally I would like to prompt for authorization and extended permissions for my desktop app when a user logins into the web front end then save the sessionKey and uid in the database.

At night when my process runs, I would reference the sessionKey and uid in order and update the user's status.

I am finding myself fumbling between whether or not my app should be a web or desktop app. Having both a web and desktop app would be confusing to my users, because they would have to grant/manage permissions for both apps.

And I looking at this the wrong way? Any help would be greatly appreciated! Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about facebook