omniauth-discord 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +33 -0
- data/.github/workflows/rspec.yml +25 -0
- data/.travis.yml +17 -6
- data/README.md +13 -0
- data/example/Gemfile +5 -0
- data/example/Gemfile.lock +60 -0
- data/example/app.rb +23 -0
- data/example/config.ru +11 -0
- data/lib/omniauth/discord/version.rb +1 -1
- data/lib/omniauth/strategies/discord.rb +5 -4
- data/omniauth-discord.gemspec +2 -1
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7e8c36d444404a9248c61a4cbe2efc24ab9daedcc8d72b95371a64844c975eb
|
4
|
+
data.tar.gz: 96619b3fd3c018843e8be931f8520fda07b2b30bfae2e843e587b5259f11f236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a593ff764c850a8a4efb395e8bb8efe9cc56fe2e938aac169f782675dd89f80ff75882e0c5ac13fecf0870942371574df71da914cedf71608be80bbbcfc757cf
|
7
|
+
data.tar.gz: 061d325e89a4a29e24b8bcdaf32c6a276f5d7e96da1cef5cb2ba87478ea2b93543b873c692c1d6535c4a996eae6aa2aa6ce3c7ba793b9ae616984f0be758c001
|
@@ -0,0 +1,33 @@
|
|
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}}
|
@@ -0,0 +1,25 @@
|
|
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/.travis.yml
CHANGED
@@ -1,17 +1,28 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=ABC123
|
4
|
+
|
1
5
|
language: ruby
|
2
6
|
before_install: gem install bundler
|
3
7
|
|
4
8
|
rvm:
|
9
|
+
- 2.6.1
|
5
10
|
- 2.3.0
|
6
|
-
- 2.2
|
7
|
-
- 2.1
|
8
|
-
- 2.0
|
9
11
|
- jruby-head
|
10
|
-
|
11
|
-
|
12
|
+
|
12
13
|
gemfile:
|
13
14
|
- Gemfile
|
14
15
|
|
15
16
|
notifications:
|
16
|
-
email:
|
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
|
17
26
|
|
27
|
+
after_script:
|
28
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/README.md
CHANGED
@@ -47,6 +47,15 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
47
47
|
end
|
48
48
|
```
|
49
49
|
|
50
|
+
You can set callback url
|
51
|
+
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
55
|
+
provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_SECRET'], scope: 'email identify', callback_url: 'https://someurl.com/users/auth/discord/callback'
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
50
59
|
## Specifying additional permissions
|
51
60
|
|
52
61
|
You can also request additional permissions from the user. See the
|
@@ -61,6 +70,10 @@ end
|
|
61
70
|
This will request permission to the MANAGE_CHANNELS and the MANAGE_ROLES
|
62
71
|
permissions.
|
63
72
|
|
73
|
+
## Specifying the prompt options
|
74
|
+
|
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.
|
76
|
+
|
64
77
|
## Contributing
|
65
78
|
|
66
79
|
Bug reports and pull requests are welcome on GitHub at https://github.com/adaoraul/omniauth-discord.
|
data/example/Gemfile
ADDED
@@ -0,0 +1,60 @@
|
|
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
ADDED
@@ -0,0 +1,23 @@
|
|
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
ADDED
@@ -0,0 +1,11 @@
|
|
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
|
@@ -8,11 +8,11 @@ module OmniAuth
|
|
8
8
|
option :name, 'discord'
|
9
9
|
|
10
10
|
option :client_options,
|
11
|
-
site: 'https://
|
11
|
+
site: 'https://discord.com/api',
|
12
12
|
authorize_url: 'oauth2/authorize',
|
13
13
|
token_url: 'oauth2/token'
|
14
14
|
|
15
|
-
option :authorize_options, %i[scope permissions]
|
15
|
+
option :authorize_options, %i[scope permissions prompt]
|
16
16
|
|
17
17
|
uid { raw_info['id'] }
|
18
18
|
|
@@ -20,7 +20,8 @@ module OmniAuth
|
|
20
20
|
{
|
21
21
|
name: raw_info['username'],
|
22
22
|
email: raw_info['verified'] ? raw_info['email'] : nil,
|
23
|
-
|
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,
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
@@ -36,7 +37,7 @@ module OmniAuth
|
|
36
37
|
|
37
38
|
def callback_url
|
38
39
|
# Discord does not support query parameters
|
39
|
-
full_host + script_name + callback_path
|
40
|
+
options[:callback_url] || (full_host + script_name + callback_path)
|
40
41
|
end
|
41
42
|
|
42
43
|
def authorize_params
|
data/omniauth-discord.gemspec
CHANGED
@@ -17,10 +17,11 @@ 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'
|
20
|
+
spec.add_runtime_dependency 'omniauth', '~> 2.0.4'
|
21
21
|
spec.add_runtime_dependency 'omniauth-oauth2'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'rack-test'
|
24
|
+
spec.add_development_dependency 'rake'
|
24
25
|
spec.add_development_dependency 'rspec'
|
25
26
|
spec.add_development_dependency 'simplecov'
|
26
27
|
spec.add_development_dependency 'webmock'
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-discord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adão Raul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
@@ -25,13 +39,13 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: rack-test
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
|
-
type: :
|
48
|
+
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -101,6 +115,8 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- ".github/workflows/gem-push.yml"
|
119
|
+
- ".github/workflows/rspec.yml"
|
104
120
|
- ".gitignore"
|
105
121
|
- ".rubocop.yml"
|
106
122
|
- ".travis.yml"
|
@@ -108,6 +124,10 @@ files:
|
|
108
124
|
- LICENSE.txt
|
109
125
|
- README.md
|
110
126
|
- Rakefile
|
127
|
+
- example/Gemfile
|
128
|
+
- example/Gemfile.lock
|
129
|
+
- example/app.rb
|
130
|
+
- example/config.ru
|
111
131
|
- lib/omniauth-discord.rb
|
112
132
|
- lib/omniauth/discord.rb
|
113
133
|
- lib/omniauth/discord/version.rb
|
@@ -132,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
152
|
- !ruby/object:Gem::Version
|
133
153
|
version: '0'
|
134
154
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.1.4
|
136
156
|
signing_key:
|
137
157
|
specification_version: 4
|
138
158
|
summary: Discord OAuth2 Strategy for OmniAuth
|