Skip to content

Commit

Permalink
Merge pull request WebTheoryLLC#2 from almirsarajcic/master
Browse files Browse the repository at this point in the history
Fix issue WebTheoryLLC#1 (change Auth Hash)
  • Loading branch information
jcgertig committed Mar 1, 2015
2 parents c90a93f + 1161766 commit 68688be
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
54 changes: 28 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,39 @@ Rails.application.config.middleware.use OmniAuth::Builder do
end
```



## Auth Hash

Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:

```ruby
{"provider"=>"twitch",
"uid"=>12345678,
"info"=>
{"display_name"=>"johndoe",
"name"=>"johndoe",
"email"=>"johndoe@gmail.com",
"bio"=>"My channel.",
"logo"=>nil,
"type"=>"user"},
"credentials"=>{"token"=>"asdfghjklasdfghjklasdfghjkl", "expires"=>false},
"extra"=>
{"raw_info"=>
{"display_name"=>"johndoe",
"_id"=>12345678,
"name"=>"johndoe",
"type"=>"user",
"bio"=>"My channel.",
"created_at"=>"2011-07-01T19:46:21Z",
"updated_at"=>"2014-05-06T05:59:37Z",
"logo"=>nil,
"_links"=>{"self"=>"https://api.twitch.tv/kraken/users/johndoe"},
"email"=>"johdoe@gmail.com",
"partnered"=>false
}
{
provider: 'twitch',
uid: 12345678,
info: {
name: 'JohnDoe',
email: 'johndoe@gmail.com',
nickname: 'johndoe',
description: 'My channel.',
image: 'http://static-cdn.jtvnw.net/jtv-static/404_preview-300x300.png',
},
credentials: {
token: 'asdfghjklasdfghjklasdfghjkl', # OAuth 2.0 access_token, which you may wish to store
expires: false # this will always be false
},
extra: {
raw_info: {
display_name: 'JohnDoe',
_id: 12345678,
name: 'johndoe',
type: 'user',
bio:"My channel.",
created_at:"2011-07-01T19:46:21Z",
updated_at:"2014-05-06T05:59:37Z",
logo:nil,
_links: { self: 'https://api.twitch.tv/kraken/users/johndoe'},
email:'johdoe@gmail.com',
partnered:false
}
}
}
```
10 changes: 5 additions & 5 deletions lib/omniauth/strategies/twitch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class Twitch < OmniAuth::Strategies::OAuth2

info do
{
display_name: raw_info['display_name'],
name: raw_info['name'],
name: raw_info['display_name'],
email: raw_info['email'],
bio: raw_info['bio'],
logo: raw_info['logo'],
type: raw_info['type']
nickname: raw_info['name'],
description: raw_info['bio'],
image: raw_info['logo'],
urls: { Twitch: "http://www.twitch.tv/#{raw_info['name']}" }
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/twitch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module OmniAuth
module Twitch
VERSION = "0.1.2"
VERSION = "0.2.0"
end
end

0 comments on commit 68688be

Please sign in to comment.