I am using Omniauth for the purpose of connecting the user to my app
via facebook/twitter...therefore the CanCan combo wont really be of
much use unless I assign privileges to certain users in my app. The
issue I am encountering is specific to the hash of user specific
information that facebook/twitter passes into my app via the
registration callback.


thanks for the suggestion.

On Dec 22, 7:23 pm, MarcRic <[email protected]> wrote:
> 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...
>
> All the best.
>
> --
> MarcRicwww.marcric.comhttp://marcricblog.blogspot.com/http://www.traineronrails.com/http://groups.google.com.br/group/riorubyrails
>
> On Dec 22, 1:45 am, Stephen <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to