omniauth-roblox 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ec3d5c9661ea76aa87c1966cbcc91ec1de7aa28f8fb4cfbb8aa3d645c08b9b7
4
- data.tar.gz: 5c171cd33bdd360051e49724418bed1eb431b0d56ff7994896176ae4b3122e90
3
+ metadata.gz: b23dc782e6a4fd1f557b1f3a8dbc8fd225fac1d5ee92d9ac3840c45e4beddc2c
4
+ data.tar.gz: 92a13f6586a2cfa7a2c9007161b667c8c2bd8ff23b9afc8e89e60637ae4d0a24
5
5
  SHA512:
6
- metadata.gz: 85e4ff0f7547db4b04d96154b9e6430f47b5715a43a5e62008846d1ff5ff962cae1a491960213b181ccd02266a6bd44747b03634e6b8d0dfc760bf5df494b39e
7
- data.tar.gz: b6e7f4e2a59447dd0bc14c5baaa489fb637fb6ffb25935ee816f9c77c445b2ad450d8d1b78d7cb49bb4158c141a4ef79c2abbc94ea91c877b9ba8a75cdb4ba95
6
+ metadata.gz: d44f56dc85f3fb1c53c00c5fcc4617450b4946492820480426fd925b45ed5c4424d5455079bb5776adca5c691e6fe7cf88beda950ee790a42610dc40bfceafd9
7
+ data.tar.gz: 6e733ed48328390676540e81429ae94066a8453f5aa0cf1ae1a45ea82cbf5992fdd60c69c73e62d90eb8f514e37a69a4d7c817d79c3a563e59883dda34f6c96d
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'rake', group: 'development'
8
- gem 'rubocop', '~> 1.36', group: 'development'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', group: 'development'
8
+ gem 'rubocop', '~> 1.36', group: 'development'
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
- PATH
2
- remote: .
3
- specs:
4
- omniauth-roblox (0.0.1)
5
- jwt (~> 2.5)
6
- omniauth (~> 2.1)
7
- omniauth-oauth2 (~> 1.8)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ast (2.4.2)
13
- faraday (2.5.2)
14
- faraday-net_http (>= 2.0, < 3.1)
15
- ruby2_keywords (>= 0.0.4)
16
- faraday-net_http (3.0.0)
17
- hashie (5.0.0)
18
- json (2.6.2)
19
- jwt (2.5.0)
20
- multi_xml (0.6.0)
21
- oauth2 (2.0.8)
22
- faraday (>= 0.17.3, < 3.0)
23
- jwt (>= 1.0, < 3.0)
24
- multi_xml (~> 0.5)
25
- rack (>= 1.2, < 3)
26
- snaky_hash (~> 2.0)
27
- version_gem (~> 1.1)
28
- omniauth (2.1.0)
29
- hashie (>= 3.4.6)
30
- rack (>= 2.2.3)
31
- rack-protection
32
- omniauth-oauth2 (1.8.0)
33
- oauth2 (>= 1.4, < 3)
34
- omniauth (~> 2.0)
35
- parallel (1.22.1)
36
- parser (3.1.2.1)
37
- ast (~> 2.4.1)
38
- rack (2.2.4)
39
- rack-protection (2.2.2)
40
- rack
41
- rainbow (3.1.1)
42
- rake (13.0.6)
43
- regexp_parser (2.5.0)
44
- rexml (3.2.5)
45
- rubocop (1.36.0)
46
- json (~> 2.3)
47
- parallel (~> 1.10)
48
- parser (>= 3.1.2.1)
49
- rainbow (>= 2.2.2, < 4.0)
50
- regexp_parser (>= 1.8, < 3.0)
51
- rexml (>= 3.2.5, < 4.0)
52
- rubocop-ast (>= 1.20.1, < 2.0)
53
- ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 1.4.0, < 3.0)
55
- rubocop-ast (1.21.0)
56
- parser (>= 3.1.1.0)
57
- ruby-progressbar (1.11.0)
58
- ruby2_keywords (0.0.5)
59
- snaky_hash (2.0.0)
60
- hashie
61
- version_gem (~> 1.1)
62
- unicode-display_width (2.2.0)
63
- version_gem (1.1.0)
64
-
65
- PLATFORMS
66
- x86_64-linux
67
-
68
- DEPENDENCIES
69
- omniauth-roblox!
70
- rake
71
- rubocop (~> 1.36)
72
-
73
- BUNDLED WITH
74
- 2.3.21
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-roblox (0.0.4)
5
+ omniauth (~> 2.1)
6
+ omniauth-oauth2 (~> 1.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ faraday (2.7.4)
13
+ faraday-net_http (>= 2.0, < 3.1)
14
+ ruby2_keywords (>= 0.0.4)
15
+ faraday-net_http (3.0.2)
16
+ hashie (5.0.0)
17
+ json (2.6.3)
18
+ jwt (2.7.0)
19
+ multi_xml (0.6.0)
20
+ oauth2 (2.0.9)
21
+ faraday (>= 0.17.3, < 3.0)
22
+ jwt (>= 1.0, < 3.0)
23
+ multi_xml (~> 0.5)
24
+ rack (>= 1.2, < 4)
25
+ snaky_hash (~> 2.0)
26
+ version_gem (~> 1.1)
27
+ omniauth (2.1.1)
28
+ hashie (>= 3.4.6)
29
+ rack (>= 2.2.3)
30
+ rack-protection
31
+ omniauth-oauth2 (1.8.0)
32
+ oauth2 (>= 1.4, < 3)
33
+ omniauth (~> 2.0)
34
+ parallel (1.22.1)
35
+ parser (3.2.2.0)
36
+ ast (~> 2.4.1)
37
+ rack (3.0.7)
38
+ rack-protection (3.0.5)
39
+ rack
40
+ rainbow (3.1.1)
41
+ rake (13.0.6)
42
+ regexp_parser (2.7.0)
43
+ rexml (3.2.5)
44
+ rubocop (1.49.0)
45
+ json (~> 2.3)
46
+ parallel (~> 1.10)
47
+ parser (>= 3.2.0.0)
48
+ rainbow (>= 2.2.2, < 4.0)
49
+ regexp_parser (>= 1.8, < 3.0)
50
+ rexml (>= 3.2.5, < 4.0)
51
+ rubocop-ast (>= 1.28.0, < 2.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 2.4.0, < 3.0)
54
+ rubocop-ast (1.28.0)
55
+ parser (>= 3.2.1.0)
56
+ ruby-progressbar (1.13.0)
57
+ ruby2_keywords (0.0.5)
58
+ snaky_hash (2.0.1)
59
+ hashie
60
+ version_gem (~> 1.1, >= 1.1.1)
61
+ unicode-display_width (2.4.2)
62
+ version_gem (1.1.2)
63
+
64
+ PLATFORMS
65
+ arm64-darwin-22
66
+ x86_64-linux
67
+
68
+ DEPENDENCIES
69
+ omniauth-roblox!
70
+ rake
71
+ rubocop (~> 1.36)
72
+
73
+ BUNDLED WITH
74
+ 2.4.10
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Wolftallemo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Wolftallemo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
data/README.md CHANGED
@@ -1,29 +1,28 @@
1
- # OmniAuth Roblox
2
- OmniAuth strategy for Roblox
3
-
4
- ## Installation
5
- Add to your `Gemfile`
6
- ```
7
- gem 'omniauth-roblox'
8
- ```
9
- Run `bundle install`
10
-
11
- ## Setup
12
- ⚠️ Roblox's OAuth API is currently private access only ⚠️
13
-
14
- - Go to https://create.roblox.com/credentials
15
- - Fill out the fields and select your scopes
16
-
17
- ## Usage
18
- An example of adding this middleware to your Rails app in `config/initializers/omniauth.rb`
19
- ```rb
20
- Rails.application.config.middleware.use OmniAuth::Builder do
21
- provider :roblox, ENV['RBX_CLIENT_ID'], ENV['RBX_CLIENT_SECRET']
22
- end
23
- ```
24
-
25
- ## Configuration Options
26
- - `scope`: No scopes are currently set by default, Roblox requires the `openid` scope at the minimum.
27
- - `image_type`: The type of image that should be returned by roblox, defaults to `headshot`. Allowed values: `[empty string]` (full body), `bust`, and `headshot`.
28
- - `jwt_leeway`: Amount of leeway in seconds passed to the JWT library, only works with version 2.1 or earlier.
29
- - `skip_image`: If this is set to `true`, no image url will be returned.
1
+ # OmniAuth Roblox
2
+ OmniAuth strategy for Roblox
3
+
4
+ ## Installation
5
+ Add to your `Gemfile`
6
+ ```
7
+ gem 'omniauth-roblox'
8
+ ```
9
+ Run `bundle install`
10
+
11
+ ## Setup
12
+ ⚠️ Roblox's OAuth API is currently private access only ⚠️
13
+
14
+ - Go to https://create.roblox.com/credentials
15
+ - Fill out the fields and select your scopes
16
+
17
+ ## Usage
18
+ An example of adding this middleware to your Rails app in `config/initializers/omniauth.rb`
19
+ ```rb
20
+ Rails.application.config.middleware.use OmniAuth::Builder do
21
+ provider :roblox, ENV['RBX_CLIENT_ID'], ENV['RBX_CLIENT_SECRET']
22
+ end
23
+ ```
24
+
25
+ ## Configuration Options
26
+ - `scope`: No scopes are currently set by default, Roblox requires the `openid` scope at the minimum.
27
+ - `image_type`: The type of image that should be returned by roblox, defaults to `headshot`. Allowed values: `[empty string]` (full body), `bust`, and `headshot`.
28
+ - `skip_image`: If this is set to `true`, no image url will be returned.
@@ -1,98 +1,101 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'jwt'
5
- require 'net/http'
6
- require 'omniauth/strategies/oauth2'
7
- require 'uri'
8
-
9
- module OmniAuth
10
- module Strategies
11
- # This is the Roblox OAuth/OIDC strategy
12
- # Currently their API is in private beta
13
- # If you are enrolled, you may register
14
- # at https://create.roblox.com/credentials
15
- class Roblox < OmniAuth::Strategies::OAuth2
16
- option :name, 'roblox'
17
-
18
- option :client_options,
19
- authorize_url: 'v1/authorize',
20
- site: 'https://apis.roblox.com/oauth',
21
- token_url: 'v1/token'
22
-
23
- option :jwt_leeway, 60
24
- option :authorize_options, %i[consent login selectAccount]
25
- option :image_type, 'headshot'
26
- option :skip_image, false
27
-
28
- def authorize_params # rubocop:disable Metrics/AbcSize
29
- super.tap do |params|
30
- options[:authorize_options].each do |k|
31
- params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
32
- end
33
-
34
- session['omniauth.state'] = params[:state] if params[:state]
35
- end
36
- end
37
-
38
- uid { raw_info['sub'] }
39
-
40
- info do
41
- {
42
- name: raw_info['name'],
43
- nickname: user_info['nickname'],
44
- image: image_url,
45
- # This is provided in the `profile` claim, but is not included if the `profile` scope is not set
46
- urls: { website: "https://www.roblox.com/users/#{uid}/profile" }
47
- }
48
- end
49
-
50
- extra do
51
- { raw_info: raw_info }
52
- end
53
-
54
- def raw_info
55
- @raw_info ||= ::JWT.decode(access_token['id_token'], nil, false).first
56
-
57
- return if @raw_info['name']
58
-
59
- user_api_res = Net::HTTP.get_response(URI("https://users.roblox.com/v1/users/#{uid}"))
60
-
61
- # The Roblox Users API returns usernames under the `name` property
62
- # Unlike the id_token where it is the display name
63
- return unless user_api_res.is_a?(Net::HTTPSuccess)
64
-
65
- api_data = JSON.parse(user_api_res.body)
66
- @raw_info['nickname'] = api_data['name']
67
- @raw_info['name'] = api_data['displayName']
68
- end
69
-
70
- # Roblox currently does not allow third parties to access user emails, this is only added for completeness
71
- def verified_email
72
- raw_info['email_verified'] ? raw_info['email'] : nil
73
- end
74
-
75
- def image_url # rubocop:disable Metrics
76
- return nil if options[:skip_image]
77
-
78
- url = 'https://thumbnails.roblox.com/v1/users/avatar'
79
- url_additions = {
80
- bust: '-bust',
81
- headshot: '-headshot'
82
- }
83
- uri = URI(url + url_additions[options[:image_type]])
84
- uri.query = URI.encode_www_form({
85
- userIds: raw_info['sub'],
86
- size: '720x720',
87
- format: 'Png',
88
- isCircular: 'false'
89
- })
90
-
91
- res = Net::HTTP.get_response(uri)
92
- data = JSON.parse(res.body).data.first
93
-
94
- res.is_a?(Net::HTTPSuccess) ? data.imageUrl : nil
95
- end
96
- end
97
- end
98
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require 'json'
5
+ require 'net/http'
6
+ require 'omniauth/strategies/oauth2'
7
+ require 'uri'
8
+
9
+ module OmniAuth
10
+ module Strategies
11
+ # This is the Roblox OAuth/OIDC strategy
12
+ # Currently their API is in private beta
13
+ # If you are enrolled, you may register
14
+ # at https://create.roblox.com/credentials
15
+ class Roblox < OmniAuth::Strategies::OAuth2
16
+ option :name, 'roblox'
17
+
18
+ option :client_options,
19
+ authorize_url: 'v1/authorize',
20
+ site: 'https://apis.roblox.com/oauth',
21
+ token_url: 'v1/token'
22
+
23
+ option :authorize_options, %i[consent login selectAccount]
24
+ option :image_type, 'headshot'
25
+ option :skip_image, false
26
+
27
+ def authorize_params # rubocop:disable Metrics/AbcSize
28
+ super.tap do |params|
29
+ options[:authorize_options].each do |k|
30
+ params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
31
+ end
32
+
33
+ session['omniauth.state'] = params[:state] if params[:state]
34
+ end
35
+ end
36
+
37
+ uid { raw_info['sub'] }
38
+
39
+ info do
40
+ {
41
+ name: raw_info['name'],
42
+ nickname: user_info['nickname'],
43
+ image: image_url,
44
+ # This is provided in the `profile` claim, but is not included if the `profile` scope is not set
45
+ urls: { website: "https://www.roblox.com/users/#{uid}/profile" }
46
+ }
47
+ end
48
+
49
+ extra do
50
+ { raw_info: raw_info }
51
+ end
52
+
53
+ def raw_info
54
+ @raw_info ||= JSON.parse(
55
+ Base64.urlsafe_decode(
56
+ access_token['id_token'].split('.')[1]
57
+ )
58
+ )
59
+
60
+ return if @raw_info['name']
61
+
62
+ user_api_res = Net::HTTP.get_response(URI("https://users.roblox.com/v1/users/#{uid}"))
63
+
64
+ # The Roblox Users API returns usernames under the `name` property
65
+ # Unlike the id_token where it is the display name
66
+ return unless user_api_res.is_a?(Net::HTTPSuccess)
67
+
68
+ api_data = JSON.parse(user_api_res.body)
69
+ @raw_info['nickname'] = api_data['name']
70
+ @raw_info['name'] = api_data['displayName']
71
+ end
72
+
73
+ # Roblox currently does not allow third parties to access user emails, this is only added for completeness
74
+ def verified_email
75
+ raw_info['email_verified'] ? raw_info['email'] : nil
76
+ end
77
+
78
+ def image_url # rubocop:disable Metrics
79
+ return nil if options[:skip_image]
80
+
81
+ url = 'https://thumbnails.roblox.com/v1/users/avatar'
82
+ url_additions = {
83
+ bust: '-bust',
84
+ headshot: '-headshot'
85
+ }
86
+ uri = URI(url + url_additions[options[:image_type]])
87
+ uri.query = URI.encode_www_form({
88
+ userIds: raw_info['sub'],
89
+ size: '720x720',
90
+ format: 'Png',
91
+ isCircular: 'false'
92
+ })
93
+
94
+ res = Net::HTTP.get_response(uri)
95
+ data = JSON.parse(res.body).data.first
96
+
97
+ res.is_a?(Net::HTTPSuccess) ? data.imageUrl : nil
98
+ end
99
+ end
100
+ end
101
+ end
@@ -1,5 +1,5 @@
1
- module OmniAuth
2
- module Roblox
3
- VERSION = '0.0.3'
4
- end
5
- end
1
+ module OmniAuth
2
+ module Roblox
3
+ VERSION = '0.0.4'
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
- require 'omniauth-roblox/version'
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-roblox/version'
4
4
  require 'omniauth/strategies/roblox'
@@ -1,18 +1,17 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('lib/omniauth-roblox/version', __dir__)
4
-
5
- Gem::Specification.new do |gem|
6
- gem.authors = ['Wolftallemo']
7
- gem.files = `git ls-files`.split("\n")
8
- gem.homepage = 'https://github.com/Wolftallemo/omniauth-roblox'
9
- gem.license = 'MIT'
10
- gem.name = 'omniauth-roblox'
11
- gem.required_ruby_version = '>= 2.7.2'
12
- gem.summary = 'OmniAuth strategy for Roblox'
13
- gem.version = OmniAuth::Roblox::VERSION
14
-
15
- gem.add_dependency 'jwt', '~> 2.5'
16
- gem.add_dependency 'omniauth', '~> 2.1'
17
- gem.add_dependency 'omniauth-oauth2', '~> 1.8'
18
- end
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('lib/omniauth-roblox/version', __dir__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.authors = ['Wolftallemo']
7
+ gem.files = `git ls-files`.split("\n")
8
+ gem.homepage = 'https://github.com/Wolftallemo/omniauth-roblox'
9
+ gem.license = 'MIT'
10
+ gem.name = 'omniauth-roblox'
11
+ gem.required_ruby_version = '>= 2.7.2'
12
+ gem.summary = 'OmniAuth strategy for Roblox'
13
+ gem.version = OmniAuth::Roblox::VERSION
14
+
15
+ gem.add_dependency 'omniauth', '~> 2.1'
16
+ gem.add_dependency 'omniauth-oauth2', '~> 1.8'
17
+ end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-roblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolftallemo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: jwt
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.5'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: omniauth
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
72
  - !ruby/object:Gem::Version
87
73
  version: '0'
88
74
  requirements: []
89
- rubygems_version: 3.3.7
75
+ rubygems_version: 3.4.10
90
76
  signing_key:
91
77
  specification_version: 4
92
78
  summary: OmniAuth strategy for Roblox