I followed the Ruby on Rails Tutorial book and created my own authentication and signup system. I now am trying to replace that with Omniauth using Twitter authentication.
I followed all the steps in the railscast and it works, but now I'm trying to save a couple more user info fields upon user creation and开发者_Go百科 they aren't saving. Here's the code to create the user:
def self.create_with_omniauth(auth)
create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
user.name = auth["user_info"]["name"]
user.email = auth["user_info"]["email"]
user.time_zone = auth["user_info"]["time_zone"]
end
end
and here's my code for current_user if needed:
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
Also, where can I find a list of user info I can get from a user signing in using twitter? I need a couple other pieces of info and can't seem to find it.
Thanks!
Simple answer is twitter doesn't allow you to grab their email address.
精彩评论