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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With