omniauth-twitch 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5ecadb9a41c29aa7a689c417c0e845cf4f9ecd83
4
- data.tar.gz: abf17ab0748e156b3598286e0dfb465c8f5b503d
2
+ SHA256:
3
+ metadata.gz: b268722aef004621781a7ffa006454b0bb28c75f6795ff047f19a8f1ea710e35
4
+ data.tar.gz: fff97d477cb6c0c73b46ecd59b4c5961301b435aa918dadd432e03168cfc5f08
5
5
  SHA512:
6
- metadata.gz: 636af1dd58e652e4f9c5c965d68e37473e71acc0e486d292bf8ac33f60bfbdc43fb6e232b40785ca31dee89c7287e02c93df17c47e98a10323639e57c854d3e5
7
- data.tar.gz: c3d23ce153fb2f355416fb1fe2f0a9e02270ff4dfb015c4e4e4af906e6de24501478444cccf2a46ba6287752b4b2dd86d87aff4813cbed747144bfefde1bd9c8
6
+ metadata.gz: dc77dc2a7a3606cf7b9e8b62c692f4ccab9bf2637b0052cbac6cd3214f8f633a30d0a52d4bc2b138f6fdb10adf23d1b683a6f7794fe799d50bc75a6cf982d4fe
7
+ data.tar.gz: b584d9a832cd3c19ac665177599cae446495f430ad4601df8643c0f2ed6c6d62d7673992fcc706f1479b563030c1a5c8985ef56faf751065c44767420b3db1f3
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Jonathan Gertig
1
+ Copyright (c) 2018 Jonathan Gertig
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,21 +2,16 @@
2
2
 
3
3
  # OmniAuth::Twitch
4
4
 
5
- A OmniAuth strategy for Twitch recently updated to helix api
5
+ A OmniAuth strategy for Twitch
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ Add the OmniAuth Twitch and OmniAuth gem rails_csrf_protection gems to your Gemfile
10
10
 
11
- gem 'omniauth-twitch'
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install omniauth-twitch
11
+ ```ruby
12
+ gem 'omniauth-twitch'
13
+ gem 'omniauth-rails_csrf_protection'
14
+ ```
20
15
 
21
16
  ## Usage
22
17
 
@@ -35,31 +30,34 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
35
30
  ```ruby
36
31
  {
37
32
  provider: 'twitch',
38
- uid: 12345678,
33
+ uid: '12345678',
39
34
  info: {
40
35
  name: 'JohnDoe',
41
36
  email: 'johndoe@gmail.com',
42
37
  nickname: 'johndoe',
43
38
  description: 'My channel.',
44
39
  image: 'http://static-cdn.jtvnw.net/jtv-static/404_preview-300x300.png',
40
+ urls: {
41
+ Twitch: 'http://www.twitch.tv/johndoe'
42
+ }
45
43
  },
46
44
  credentials: {
47
45
  token: 'asdfghjklasdfghjklasdfghjkl', # OAuth 2.0 access_token, which you may wish to store
48
- expires: false # this will always be false
46
+ expires: false # this will always be false,
47
+ refresh_token: 'asdschbjh24h23yfsjfhbsjdc3a' # OAuth 2.0 refresh token, to renew the access token when it expires
49
48
  },
50
49
  extra: {
51
50
  raw_info: {
52
51
  display_name: 'JohnDoe',
53
- _id: 12345678,
54
- name: 'johndoe',
55
- type: 'user',
56
- bio:"My channel.",
57
- created_at:"2011-07-01T19:46:21Z",
58
- updated_at:"2014-05-06T05:59:37Z",
59
- logo:nil,
60
- _links: { self: 'https://api.twitch.tv/kraken/users/johndoe'},
61
- email:'johdoe@gmail.com',
62
- partnered:false
52
+ id: '12345678',
53
+ login: 'johndoe',
54
+ type: '',
55
+ broadcaster_type: '',
56
+ description: 'My channel.',
57
+ profile_image_url: 'https://static-cdn.jtvnw.net/user-default-pictures/0ecbb6c3-fecb-4016-8115-aa467b7c36ed-profile_image-300x300.jpg',
58
+ offline_image_url: '',
59
+ view_count: 100500,
60
+ email: 'johdoe@gmail.com'
63
61
  }
64
62
  }
65
63
  }
@@ -10,7 +10,8 @@ module OmniAuth
10
10
  option :client_options, {
11
11
  site: "https://id.twitch.tv",
12
12
  authorize_url: "/oauth2/authorize",
13
- token_url: "/oauth2/token"
13
+ token_url: "/oauth2/token",
14
+ auth_scheme: :request_body
14
15
  }
15
16
 
16
17
  option :access_token_options, {
@@ -20,6 +21,12 @@ module OmniAuth
20
21
 
21
22
  option :authorize_options, [:scope]
22
23
 
24
+ def request_phase
25
+ redirect client.auth_code.
26
+ authorize_url({ redirect_uri: callback_url }.merge(authorize_params)).
27
+ gsub(/%2[b,B]/, "+")
28
+ end
29
+
23
30
  credentials do
24
31
  hash = { "token" => access_token.token }
25
32
  if access_token.refresh_token
@@ -51,7 +58,8 @@ module OmniAuth
51
58
 
52
59
  def raw_info
53
60
  @raw_info ||=
54
- access_token.get("https://api.twitch.tv/helix/users").parsed.
61
+ access_token.get("https://api.twitch.tv/helix/users",
62
+ headers: { "Client-ID" => client.id }).parsed.
55
63
  fetch("data").fetch(0)
56
64
  end
57
65
 
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Twitch
3
- VERSION = "1.0.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -6,8 +6,8 @@ require 'omniauth/twitch/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "omniauth-twitch"
8
8
  spec.version = OmniAuth::Twitch::VERSION
9
- spec.authors = ["Jonathan Gertig (Webtheory) and William Holt (Webtheory)"]
10
- spec.email = ["jcgertig@gmail.com or sithtoast@gmail.com"]
9
+ spec.authors = ["Dean Perry", "Jonathan Gertig (Webtheory)", "William Holt (Webtheory)"]
10
+ spec.email = ["dean@deanpcmad.com", "jcgertig@gmail.com", "sithtoast@gmail.com"]
11
11
  spec.summary = 'Twitch OAuth2 Strategy for OmniAuth'
12
12
  spec.homepage = "https://github.com/WebTheoryLLC/omniauth-twitch"
13
13
  spec.license = "MIT"
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
20
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "bundler", "~> 2.1"
23
23
  spec.add_development_dependency "rake"
24
24
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-twitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Jonathan Gertig (Webtheory) and William Holt (Webtheory)
7
+ - Dean Perry
8
+ - Jonathan Gertig (Webtheory)
9
+ - William Holt (Webtheory)
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
13
+ date: 2022-10-28 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: omniauth-oauth2
@@ -16,28 +18,28 @@ dependencies:
16
18
  requirements:
17
19
  - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '1.1'
21
+ version: '1.6'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '1.1'
28
+ version: '1.6'
27
29
  - !ruby/object:Gem::Dependency
28
30
  name: bundler
29
31
  requirement: !ruby/object:Gem::Requirement
30
32
  requirements:
31
33
  - - "~>"
32
34
  - !ruby/object:Gem::Version
33
- version: '1.5'
35
+ version: '2.1'
34
36
  type: :development
35
37
  prerelease: false
36
38
  version_requirements: !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - - "~>"
39
41
  - !ruby/object:Gem::Version
40
- version: '1.5'
42
+ version: '2.1'
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: rake
43
45
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +56,9 @@ dependencies:
54
56
  version: '0'
55
57
  description:
56
58
  email:
57
- - jcgertig@gmail.com or sithtoast@gmail.com
59
+ - dean@deanpcmad.com
60
+ - jcgertig@gmail.com
61
+ - sithtoast@gmail.com
58
62
  executables: []
59
63
  extensions: []
60
64
  extra_rdoc_files: []
@@ -88,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
92
  - !ruby/object:Gem::Version
89
93
  version: '0'
90
94
  requirements: []
91
- rubyforge_project:
92
- rubygems_version: 2.6.14
95
+ rubygems_version: 3.3.7
93
96
  signing_key:
94
97
  specification_version: 4
95
98
  summary: Twitch OAuth2 Strategy for OmniAuth