omniauth-discord 0.1.5 → 0.1.8

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: f0cfff1687d81aa3eefb32e70fa879fe1eb44f91
4
- data.tar.gz: c29a03b00cf9ebb327ffd2fb14b2f69de575da44
2
+ SHA256:
3
+ metadata.gz: 900d4d63eabbb47265d1634ee8e2b7bd2a83815e84bec4687329b04e569e733e
4
+ data.tar.gz: 17e0d333c9681e1477c5a8a4d4c4c8c9a796ab0708cecff7d41d79a643e842ba
5
5
  SHA512:
6
- metadata.gz: 603ce11732ed36580b68585063bba28e926026b527b5db61287b0f6e58d924164fcea84babd3b84188123d4d9a21c14ac5c34c609940b1d84db8115c6eca24c3
7
- data.tar.gz: 1d4b99627158ba46dd207737496906d0a8a9ac1573c5ffdfa20fd407ba4462b4e928f214d41310ee66a4dfb46443a2ec52f23e12c458f1f500b6878aca26b810
6
+ metadata.gz: bbe55a86b15b6e9051b6407dea4dc152e5db2f14b5118a5ee41bcb8da271dcfac506e22d12c88272f71cd380207409652754f4bfa3e2c73159ffdb681b2a1eb1
7
+ data.tar.gz: 6733b8307b50f81b6839f8230feb1cdc6c21fe3ecbb0dc3a3f353bc31eae4abeeedd0aa0f1b1fec9a720852a908cf5cc2ab2efb0679f2994e557b0db09e3fdec
data/README.md CHANGED
@@ -22,19 +22,45 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
22
22
 
23
23
  ```ruby
24
24
  Rails.application.config.middleware.use OmniAuth::Builder do
25
- provider :discord, ENV['DISCORD_APPID'], ENV['DISCORD_SECRET']
25
+ provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_SECRET']
26
26
  end
27
27
  ```
28
28
 
29
- By default, Discord does not return a user's email address. Set the scope to
30
- `email` to get it:
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`.
31
33
 
32
34
  ```ruby
33
35
  Rails.application.config.middleware.use OmniAuth::Builder do
34
- provider :discord, ENV['DISCORD_APPID'], ENV['DISCORD_SECRET'], scope: 'email'
36
+ provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_SECRET'], scope: 'email'
35
37
  end
36
38
  ```
37
39
 
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`
42
+
43
+
44
+ ```ruby
45
+ Rails.application.config.middleware.use OmniAuth::Builder do
46
+ provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_SECRET'], scope: 'email identify'
47
+ end
48
+ ```
49
+
50
+ ## Specifying additional permissions
51
+
52
+ You can also request additional permissions from the user. See the
53
+ [permission help page](https://discordapp.com/developers/docs/topics/permissions#bitwise-permission-flags) for a list of all available options.
54
+
55
+ ```ruby
56
+ Rails.application.config.middleware.use OmniAuth::Builder do
57
+ provider :discord, ENV['DISCORD_CLIENT_ID'], ENV['DISCORD_CLIENT_SECRET'], scope: 'identify bot', permissions: 0x00000010 + 0x10000000
58
+ end
59
+ ```
60
+
61
+ This will request permission to the MANAGE_CHANNELS and the MANAGE_ROLES
62
+ permissions.
63
+
38
64
  ## Contributing
39
65
 
40
66
  Bug reports and pull requests are welcome on GitHub at https://github.com/adaoraul/omniauth-discord.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Discord
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
@@ -13,14 +13,14 @@ module OmniAuth
13
13
  :token_url => 'oauth2/token'
14
14
  }
15
15
 
16
- option :authorize_options, [:scope]
16
+ option :authorize_options, [:scope, :permissions]
17
17
 
18
18
  uid { raw_info['id'] }
19
19
 
20
20
  info do
21
21
  {
22
22
  :name => raw_info['username'],
23
- :email => raw_info['email'],
23
+ :email => raw_info['verified'] ? raw_info['email'] : nil,
24
24
  :image => "https://cdn.discordapp.com/avatars/#{raw_info['id']}/#{raw_info['avatar']}"
25
25
  }
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.8
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: 2017-08-02 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.6.11
136
+ rubygems_version: 2.7.6
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Discord OAuth2 Strategy for OmniAuth