November 13, 2011 § 3 Comments
This post is a reply from someone who emailed me, he asked me how to save the user data that already login to our site using facebook graph API.
after we create a login scheme using facebook and oauth2 gem, we need to save the facebook user data to our databases, so.. how to save it into the database?
it’s very easy and simple, when we get a callback from the facebook graph API and save the user data in session like this:
session[:fb_user] = JSON.parse access_token.get('/me') session[:user] = User.save_user_data(session[:fb_user])
July 5, 2011 § Leave a comment
since I wanna use the login page as a popup box use facebox.. not to redirected the user. the whole layout is appear to the facebox.. so how to make the layout false if we use devise?
simple.. check the current controller is a Devise::SessionsController or not in ApplicationController :
class ApplicationController < ActionController::Base layout :layout private def layout is_a?(Devise::SessionsController) ? false : "application" end end
July 26, 2010 § 4 Comments
let’s get started !
first, install the oauth2 gem, you can get it from here
then create a controller call oauth_controller.rb « Read the rest of this entry »