Wednesday, December 22, 2010

[Rails] Re: Having trouble with Devise /OmniAuth

Hi Stephen,

I have recently finished a Rails 3 course, and the instructor
recommends a Devise + CanCan combo.

If you make a research you will see this option being used all around.

Take this one as an example:

http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/

All the best.

--
MarcRic
www.marcric.com
http://marcricblog.blogspot.com/
http://www.traineronrails.com/
http://groups.google.com.br/group/riorubyrails


On Dec 22, 1:45 am, Stephen <stephen.sieg...@gmail.com> wrote:
> Hi All,
>
> I am using the Devise 1.2 to integrate with OmniAuth (https://
> github.com/plataformatec/devise/wiki/OmniAuth:-Overview). The
> authorization/callback process works fine but I am not able to access
> information from the user_info hash that is passed through the
> request. I have tried several things within the Users controller but I
> can't seem to fill current_user.name/image/ etc.  I am new to Rails
> and have hit somewhat of a road block and I am just looking for some
> direction.  I have exhausted the options that I am familiar with...
>
> ----User Model---
>
> def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
>   data = access_token['extra']['user_hash']
>     if user = User.find_by_email(data["email"])
>        user
>     else # Create an user with a stub password.
>       User.create!(:email => data["email"], :password =>
> Devise.friendly_token[0,20])
>     end
> end
>
> def self.new_with_session(params, session)
>     super.tap do |user|
>       if data = session["devise.facebook_data"]
>         user(:email => data["email"],:name =>
> data["name"], :avatar_url => data["image"])
>       end
>     end
>   end
>
> In the self.new_with_sessions.....I added the attributes to user
> thinking that they would be created with the new session
>
> Thanks,
>
> Stephen

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate