Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Desktop Application

So I'm trying to program a simple desktop application to login into someone's facebook. Right now that's my only objective, just log into facebook. I'm coding in Ruby and am using shoes GUI toolkit. Here's the code I have so far:

Shoes.app do
  stack(:margin => 12) do
    para "Enter your login information"
    flow do
      para "Username: "
      @login_text = edit_line
    end
    flow do
      para "Password: "
      @pass_text = edit_line(:secret => true)
    end

    @login_button = button "Login"
    @login_button.click {
      login(@login_text.text, @pass_text.text )
    }
  end
end

def login(username, password)
  alert(username + "   " + password)
end

So it's definitely getting to the login function because it alerts whatever I type into the textbox after clicking the login button. But I have no idea where to start as far as the logging into the facebook portion goes... I've tried look at Facebook's instructions and I've also tried google searching on the subject but all the tutorials are for rails.

I've seen mechanize but I don't know how well that will play with shoes because it looks like it's trying to implement it's own buttons and stuff.

I'm super new to ruby and have no idea how to login from a desktop app. Any advice or tutorials to help me out? I mean I need to start from "first include these files...", I'm an absolute beginner.

like image 741
Richard Avatar asked Oct 05 '22 07:10

Richard


1 Answers

As mentioned in the comments, your best bet might be to use OAuth, but you don't necessarily need to implement anything else to get it working. Using the oauth ruby gem, you can build a user token and do the necessary get, put, and post requests using that token. Since Facebook supports OAuth tokens (I believe), this might be the best way to do it.

Information on the ruby OAuth gem here

like image 136
user2276204 Avatar answered Oct 06 '22 21:10

user2276204