Hi开发者_运维问答 I'm want to use ruby on rails to create a facebook connect web site with full facebook integration (events API) can I use OmniAuth for authentication and facebooker to handle the facebook API together ?
Is facebooker up to date with the latest API changes in Facebook ? Can you recommend any good articles about the subject ?
Thanks Gady
You can use Onmiauth to connect to facebook.
To specicie the permissions you will need from facebook, this snippet should solve your problem :
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'APP_ID', 'APP_SECRET',{:scope => 'email,offline_access, your,scope,you,want}
end
The using of Facebooker depends of the version of rails you are using.
Facebooker is not compatible with Rails3(It wasn't a couple of month ago)
But don't worry there some alternatives :
https://github.com/arsduo/koala
https://github.com/nsanta/fbgraph
https://github.com/nov/fb_graph
If you choose to use fb_graph, this snippet should retrieve your profile :
user = FbGraph::User.new('me', :access_token => session[:omniauth]["credentials"]["token"])
user.fetch
Hope it will help you
精彩评论