Closed almirsarajcic closed 8 years ago
In other strategies info hash has differently named keys. For example, google-oauth2 strategy returns this info hash:
{ :name => "John Doe", :email => "john@company_name.com", :first_name => "John", :last_name => "Doe", :image => "https://lh3.googleusercontent.com/url/photo.jpg" }
but twitch strategy returns this:
{ display_name: "johndoe", name: 'johndoe', email: 'johndoe@gmail.com', bio: 'My channel.', logo: nil, type: 'user' }
There is Auth Hash Schema (https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema) which all omniauth strategies follow.
That way it becomes easier to create abstractions. For example, I need to save user's connected accounts in the table and for saving I'm creating a method which reads the hash returned from callbacks and writes data into appropriate fields.
In other strategies info hash has differently named keys. For example, google-oauth2 strategy returns this info hash:
but twitch strategy returns this:
There is Auth Hash Schema (https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema) which all omniauth strategies follow.
That way it becomes easier to create abstractions. For example, I need to save user's connected accounts in the table and for saving I'm creating a method which reads the hash returned from callbacks and writes data into appropriate fields.