Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

aswath87's Profile

GitHub User: aswath87

Comments by

Avatar

did you miss the 'rails g controller sessions' by any chance?

Avatar

Hey Ryan,

Thanks for the great tutorials!

I've a question - I want an additional field (besides name, email) from the user for sign up that's not present in the 'auth' returned. So I'll have to redirect the user to a page with a form
to get the additional fields as inputs and then create the new user. Please let me know what's the best way to do this.

def create
auth = request.env["omniauth.auth"]
user = User.find_by_provider_and_uid(auth["provider"], auth["uid"])
if (user == nil) #user doesn't exist in database, create new user
user = # directs to a page with a form for additional fields and use some info from auth to create new user. how do i do this?
end
session[user_id] = user.id
redirect_to root_url, :notice => "Signed in!"
end

Thanks!
Aswath