omniauth-discord 1.0.2 → 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
2
  SHA256:
3
- metadata.gz: c7e8c36d444404a9248c61a4cbe2efc24ab9daedcc8d72b95371a64844c975eb
4
- data.tar.gz: 96619b3fd3c018843e8be931f8520fda07b2b30bfae2e843e587b5259f11f236
3
+ metadata.gz: dd7659142ba5f22d8146f7844aa6d56b3c3c6a7201e623d00e0c6f0656875f4d
4
+ data.tar.gz: cd9dce4beb227213e08f3897b2e332fe89679d1edf0adb54e4144e22836415e4
5
5
  SHA512:
6
- metadata.gz: a593ff764c850a8a4efb395e8bb8efe9cc56fe2e938aac169f782675dd89f80ff75882e0c5ac13fecf0870942371574df71da914cedf71608be80bbbcfc757cf
7
- data.tar.gz: 061d325e89a4a29e24b8bcdaf32c6a276f5d7e96da1cef5cb2ba87478ea2b93543b873c692c1d6535c4a996eae6aa2aa6ce3c7ba793b9ae616984f0be758c001
6
+ metadata.gz: 611bda0c4d19ea05645a15413cb2ed035465a48c959b56fbaa618c8daf206d1deb9253423b4407cae247f935e4d96e8f20c9614bc9a0d1c46e920846f15c648a
7
+ data.tar.gz: d3a9c813cf4258adaa9bae74ecbd2c21cb11141dc88e8c68b193d4d489e78018f442ee4bd2f51d320d817a9b183339b1d1b3ad970b286e276f2eae69b3c733ce
data/README.md CHANGED
@@ -1,24 +1,22 @@
1
1
  # OmniAuth Discord
2
2
 
3
- Discord OAuth2 Strategy for OmniAuth.
3
+ OmniAuth Discord - OAuth2 Strategy for OmniAuth
4
4
 
5
- Read the Discord API documentation for more details: https://discordapp.com/developers/docs/topics/oauth2
5
+ OmniAuth Discord is an OAuth2 strategy for OmniAuth that allows you to authenticate users using Discord. If you're not familiar with Discord's OAuth2, we recommend you check out the Discord API documentation for more details.
6
6
 
7
- ## Installing
7
+ ## Installation
8
8
 
9
- Add to your `Gemfile`:
9
+ To install OmniAuth Discord, simply add the following line to your Gemfile:
10
10
 
11
11
  ```ruby
12
12
  gem 'omniauth-discord'
13
13
  ```
14
14
 
15
- Then `bundle install`.
15
+ Then run bundle install to install the gem.
16
16
 
17
17
  ## Usage
18
18
 
19
- `OmniAuth::Strategies::Discord` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
20
-
21
- Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
19
+ OmniAuth Discord is a Rack middleware. If you're not familiar with OmniAuth, we recommend reading the documentation for detailed instructions. Here's an example of how to add the middleware to a Rails app in config/initializers/omniauth.rb:
22
20
 
23
21
  ```ruby
24
22
  Rails.application.config.middleware.use OmniAuth::Builder do
@@ -26,10 +24,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
26
24
  end
27
25
  ```
28
26
 
29
- By default, Discord does not return a user's email address. Their API uses
30
- [scopes](https://discordapp.com/developers/docs/topics/oauth2#scopes) to provide
31
- access to certain resources of a user's account. For example, to get a user's
32
- email set the scope to `email`.
27
+ By default, Discord does not return a user's email address. You can request access to additional resources by setting scopes. For example, to get a user's email, you would set the scope to 'email'.
33
28
 
34
29
  ```ruby
35
30
  Rails.application.config.middleware.use OmniAuth::Builder do
@@ -37,8 +32,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
37
32
  end
38
33
  ```
39
34
 
40
- You can pass multiple scopes in the same string. For example to get a user's
41
- Discord account info set the scope to `email identify`
35
+ You can pass multiple scopes in the same string. For example, to get a user's Discord account info, you would set the scope to 'email identify'.
42
36
 
43
37
 
44
38
  ```ruby
@@ -47,7 +41,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
47
41
  end
48
42
  ```
49
43
 
50
- You can set callback url
44
+ You can also specify a callback URL by adding callback_url to the provider options.
51
45
 
52
46
 
53
47
  ```ruby
@@ -56,10 +50,9 @@ Rails.application.config.middleware.use OmniAuth::Builder do
56
50
  end
57
51
  ```
58
52
 
59
- ## Specifying additional permissions
53
+ ## Additional Permissions
60
54
 
61
- You can also request additional permissions from the user. See the
62
- [permission help page](https://discordapp.com/developers/docs/topics/permissions#bitwise-permission-flags) for a list of all available options.
55
+ You can request additional permissions from the user by setting the permissions option. For example, to request permission to the MANAGE_CHANNELS and MANAGE_ROLES permissions, you would set permissions to 0x00000010 + 0x10000000.
63
56
 
64
57
  ```ruby
65
58
  Rails.application.config.middleware.use OmniAuth::Builder do
@@ -70,15 +63,15 @@ end
70
63
  This will request permission to the MANAGE_CHANNELS and the MANAGE_ROLES
71
64
  permissions.
72
65
 
73
- ## Specifying the prompt options
66
+ ## Prompt Options
74
67
 
75
- Discord looks for the prompt option to indicate if the user should be prompted to reauthorize on sign in. Valid options are 'consent' and 'none'. Note that the use is always prompted to authorize on sign up.
68
+ You can specify the prompt options by setting the prompt option. The prompt option indicates whether the user should be prompted to reauthorize on sign in. Valid options are 'consent' and 'none'. Note that the user is always prompted to authorize on sign up.
76
69
 
77
70
  ## Contributing
78
71
 
79
- Bug reports and pull requests are welcome on GitHub at https://github.com/adaoraul/omniauth-discord.
72
+ If you find a bug or want to contribute to the project, we welcome bug reports and pull requests on GitHub.
80
73
 
81
74
 
82
75
  ## License
83
76
 
84
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
77
+ OmniAuth Discord is available as open-source software under the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,7 +1 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new
5
-
6
- desc 'Run specs'
7
- task default: :spec
1
+ require "bundler/gem_tasks"
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Discord
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module OmniAuth
12
12
  authorize_url: 'oauth2/authorize',
13
13
  token_url: 'oauth2/token'
14
14
 
15
- option :authorize_options, %i[scope permissions prompt]
15
+ option :authorize_options, %i[scope guild_id permissions prompt]
16
16
 
17
17
  uid { raw_info['id'] }
18
18
 
@@ -20,14 +20,13 @@ module OmniAuth
20
20
  {
21
21
  name: raw_info['username'],
22
22
  email: raw_info['verified'] ? raw_info['email'] : nil,
23
- # CDN is still cdn.discordapp.com
24
- image: raw_info['avatar'].present? ? "https://cdn.discordapp.com/avatars/#{raw_info['id']}/#{raw_info['avatar']}" : nil,
23
+ image: raw_info['avatar'] ? "https://cdn.discordapp.com/avatars/#{raw_info['id']}/#{raw_info['avatar']}" : nil,
25
24
  }
26
25
  end
27
26
 
28
27
  extra do
29
28
  {
30
- 'raw_info' => raw_info
29
+ raw_info: raw_info
31
30
  }
32
31
  end
33
32
 
@@ -37,7 +36,7 @@ module OmniAuth
37
36
 
38
37
  def callback_url
39
38
  # Discord does not support query parameters
40
- options[:callback_url] || (full_host + script_name + callback_path)
39
+ options[:redirect_uri] || (full_host + script_name + callback_path)
41
40
  end
42
41
 
43
42
  def authorize_params
@@ -4,12 +4,12 @@ require 'omniauth/discord/version'
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'omniauth-discord'
6
6
  spec.version = Omniauth::Discord::VERSION
7
- spec.authors = ['Adão Raul']
8
- spec.email = ['adao.raul@gmail.com']
7
+ spec.authors = ["Dean Perry", 'Adão Raul']
8
+ spec.email = ["dean@deanpcmad.com", 'adao.raul@gmail.com']
9
9
 
10
10
  spec.summary = 'Discord OAuth2 Strategy for OmniAuth'
11
11
  spec.description = spec.summary
12
- spec.homepage = 'http://github.com/adaoraul/omniauth-discord'
12
+ spec.homepage = 'https://github.com/deanpcmad/omniauth-discord'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
@@ -17,12 +17,5 @@ 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', '~> 2.0.4'
21
- spec.add_runtime_dependency 'omniauth-oauth2'
22
-
23
- spec.add_development_dependency 'rack-test'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'rspec'
26
- spec.add_development_dependency 'simplecov'
27
- spec.add_development_dependency 'webmock'
20
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
28
21
  end
metadata CHANGED
@@ -1,139 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Dean Perry
7
8
  - Adão Raul
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
12
+ date: 2024-03-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: omniauth
15
+ name: omniauth-oauth2
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: 2.0.4
20
+ version: '1.6'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: 2.0.4
27
- - !ruby/object:Gem::Dependency
28
- name: omniauth-oauth2
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rack-test
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: webmock
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
27
+ version: '1.6'
111
28
  description: Discord OAuth2 Strategy for OmniAuth
112
29
  email:
30
+ - dean@deanpcmad.com
113
31
  - adao.raul@gmail.com
114
32
  executables: []
115
33
  extensions: []
116
34
  extra_rdoc_files: []
117
35
  files:
118
- - ".github/workflows/gem-push.yml"
119
- - ".github/workflows/rspec.yml"
120
36
  - ".gitignore"
121
- - ".rubocop.yml"
122
- - ".travis.yml"
123
37
  - Gemfile
124
38
  - LICENSE.txt
125
39
  - README.md
126
40
  - Rakefile
127
- - example/Gemfile
128
- - example/Gemfile.lock
129
- - example/app.rb
130
- - example/config.ru
131
41
  - lib/omniauth-discord.rb
132
42
  - lib/omniauth/discord.rb
133
43
  - lib/omniauth/discord/version.rb
134
44
  - lib/omniauth/strategies/discord.rb
135
45
  - omniauth-discord.gemspec
136
- homepage: http://github.com/adaoraul/omniauth-discord
46
+ homepage: https://github.com/deanpcmad/omniauth-discord
137
47
  licenses:
138
48
  - MIT
139
49
  metadata: {}
@@ -152,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
62
  - !ruby/object:Gem::Version
153
63
  version: '0'
154
64
  requirements: []
155
- rubygems_version: 3.1.4
65
+ rubygems_version: 3.4.22
156
66
  signing_key:
157
67
  specification_version: 4
158
68
  summary: Discord OAuth2 Strategy for OmniAuth
@@ -1,33 +0,0 @@
1
- name: Ruby Gem
2
-
3
- on:
4
- release:
5
- types:
6
- - created
7
-
8
- jobs:
9
- build:
10
-
11
- name: Build + Publish Gem
12
- runs-on: ubuntu-latest
13
- permissions:
14
- contents: read
15
- packages: write
16
-
17
- steps:
18
- - uses: actions/checkout@v2
19
- - name: Set up Ruby
20
- uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
21
- with:
22
- ruby-version: 2.7.2
23
-
24
- - name: Publish to RubyGems
25
- run: |
26
- mkdir -p $HOME/.gem
27
- touch $HOME/.gem/credentials
28
- chmod 0600 $HOME/.gem/credentials
29
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
- gem build *.gemspec
31
- gem push *.gem
32
- env:
33
- GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -1,25 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
-
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- ruby-version: ['2.6', '2.7', '3.0']
16
-
17
- steps:
18
- - uses: actions/checkout@v2
19
- - name: Set up Ruby
20
- uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
21
- with:
22
- ruby-version: ${{ matrix.ruby-version }}
23
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24
- - name: Run tests
25
- run: bundle exec rake
data/.rubocop.yml DELETED
@@ -1,18 +0,0 @@
1
- Rails:
2
- Enabled: false
3
-
4
- Style/FrozenStringLiteralComment:
5
- Enabled: false
6
-
7
- Metrics/LineLength:
8
- Max: 120
9
-
10
- Style/Documentation:
11
- Enabled: false
12
-
13
- Naming/FileName:
14
- Enabled: false
15
-
16
- Metrics/BlockLength:
17
- ExcludedMethods:
18
- - describe
data/.travis.yml DELETED
@@ -1,28 +0,0 @@
1
- env:
2
- global:
3
- - CC_TEST_REPORTER_ID=ABC123
4
-
5
- language: ruby
6
- before_install: gem install bundler
7
-
8
- rvm:
9
- - 2.6.1
10
- - 2.3.0
11
- - jruby-head
12
-
13
- gemfile:
14
- - Gemfile
15
-
16
- notifications:
17
- email: true
18
-
19
- before_script:
20
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
21
- - chmod +x ./cc-test-reporter
22
- - ./cc-test-reporter before-build
23
-
24
- script:
25
- - bundle exec rspec
26
-
27
- after_script:
28
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/example/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sinatra'
4
- gem 'sinatra-reloader'
5
- gem 'omniauth-discord', path: '../'
data/example/Gemfile.lock DELETED
@@ -1,60 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- omniauth-discord (1.0.0)
5
- omniauth
6
- omniauth-oauth2
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- backports (3.15.0)
12
- faraday (0.15.4)
13
- multipart-post (>= 1.2, < 3)
14
- hashie (3.6.0)
15
- jwt (2.2.1)
16
- multi_json (1.13.1)
17
- multi_xml (0.6.0)
18
- multipart-post (2.1.1)
19
- mustermann (1.0.3)
20
- oauth2 (1.4.1)
21
- faraday (>= 0.8, < 0.16.0)
22
- jwt (>= 1.0, < 3.0)
23
- multi_json (~> 1.3)
24
- multi_xml (~> 0.5)
25
- rack (>= 1.2, < 3)
26
- omniauth (1.9.0)
27
- hashie (>= 3.4.6, < 3.7.0)
28
- rack (>= 1.6.2, < 3)
29
- omniauth-oauth2 (1.6.0)
30
- oauth2 (~> 1.1)
31
- omniauth (~> 1.9)
32
- rack (2.2.3)
33
- rack-protection (2.0.5)
34
- rack
35
- sinatra (2.0.5)
36
- mustermann (~> 1.0)
37
- rack (~> 2.0)
38
- rack-protection (= 2.0.5)
39
- tilt (~> 2.0)
40
- sinatra-contrib (2.0.5)
41
- backports (>= 2.8.2)
42
- multi_json
43
- mustermann (~> 1.0)
44
- rack-protection (= 2.0.5)
45
- sinatra (= 2.0.5)
46
- tilt (>= 1.3, < 3)
47
- sinatra-reloader (1.0)
48
- sinatra-contrib
49
- tilt (2.0.9)
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- omniauth-discord!
56
- sinatra
57
- sinatra-reloader
58
-
59
- BUNDLED WITH
60
- 2.0.2
data/example/app.rb DELETED
@@ -1,23 +0,0 @@
1
- require 'sinatra'
2
- require "sinatra/reloader"
3
- require 'yaml'
4
-
5
- # configure sinatra
6
- set :run, false
7
- set :raise_errors, true
8
-
9
- get '/' do
10
- content_type 'text/html'
11
- <<-HTML
12
- <html>
13
- <body>
14
- <a href="/auth/discord">Connect to Discord!</a>
15
- </body>
16
- </html>
17
- HTML
18
- end
19
-
20
- get '/auth/:provider/callback' do
21
- content_type 'application/json'
22
- MultiJson.encode(request.env)
23
- end
data/example/config.ru DELETED
@@ -1,11 +0,0 @@
1
- require 'bundler/setup'
2
- require 'omniauth-discord'
3
- require './app.rb'
4
-
5
- use Rack::Session::Cookie, secret: '123456789'
6
-
7
- use OmniAuth::Builder do
8
- provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_ID'], scope: ENV['SCOPE']
9
- end
10
-
11
- run Sinatra::Application