WebTheoryLLC / omniauth-twitch

OmniAuth Strategy for Twitch
MIT License
32 stars 22 forks source link

Keys in returned hash not the same as in other omniauth strategies #1

Closed almirsarajcic closed 8 years ago

almirsarajcic commented 9 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.