omniauth-zoom 0.0.1 → 0.1.0
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +47 -2
- data/lib/omniauth-zoom/version.rb +1 -1
- data/lib/omniauth/strategies/zoom.rb +32 -7
- data/omniauth-zoom.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 828d66467f60af0483a276e8b5ffe8d9e36aa05c30f0776fd34701abb1acb91f
|
4
|
+
data.tar.gz: a7983a8bdfdce90fa65f034924ebc94081904cae8d3264c9e1a3267a9fa46678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b49341b7c53dbf7c37cd57430a31eb1234678bf24ade879858cf7376c807f5d25af0539554f0b94b2c9513b3590eb979496344626047e6b0447116287522b7c
|
7
|
+
data.tar.gz: 71164e28b3c4450f734e0349dbc82bfbc34b346fc9fc5bad8fd9dffe6ca2fd132681c249bfbc98acd731edbd0b6caba652f10bcca63412b32903dea29f2b24bd
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -31,7 +31,8 @@ Next, tell OmniAuth about this provider. For a Rails app, your `config/initializ
|
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
34
|
-
|
34
|
+
zoom_scopes = %i[user:read meeting:read meeting:write]
|
35
|
+
provider :zoom, zoom_client_id, zoom_client_secret, :scope => zoom_scopes.join(',')
|
35
36
|
end
|
36
37
|
```
|
37
38
|
|
@@ -42,7 +43,51 @@ Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained
|
|
42
43
|
The auth hash `request.env['omniauth.auth']` would look like this:
|
43
44
|
|
44
45
|
```js
|
45
|
-
|
46
|
+
{
|
47
|
+
"result": {
|
48
|
+
"provider": "zoom",
|
49
|
+
"uid": "KdYKjnimT4KPd8FFgQt9FQ",
|
50
|
+
"info": {},
|
51
|
+
"credentials": {
|
52
|
+
"token": "ACCESS_TOKEN",
|
53
|
+
"refresh_token": "REFRESH_TOKEN",
|
54
|
+
"expires_at": 1594035991,
|
55
|
+
"expires": true
|
56
|
+
},
|
57
|
+
"extra": {
|
58
|
+
"raw_info": {
|
59
|
+
"id": "KdYKjnimT4KPd8FFgQt9FQ",
|
60
|
+
"first_name": "Jane",
|
61
|
+
"last_name": "Dev",
|
62
|
+
"email": "jane.dev@email.com",
|
63
|
+
"type": 2,
|
64
|
+
"role_name": "Owner",
|
65
|
+
"pmi": 1234567890,
|
66
|
+
"use_pmi": false,
|
67
|
+
"vanity_url": "https://janedevinc.zoom.us/my/janedev",
|
68
|
+
"personal_meeting_url": "https://janedevinc.zoom.us/j/1234567890",
|
69
|
+
"timezone": "America/Denver",
|
70
|
+
"verified": 1,
|
71
|
+
"dept": "",
|
72
|
+
"created_at": "2019-04-05T15:24:32Z",
|
73
|
+
"last_login_time": "2019-12-16T18:02:48Z",
|
74
|
+
"last_client_version": "4.6.12611.1124(mac)",
|
75
|
+
"pic_url": "https://janedev.zoom.us/p/KdYKjnimFR5Td8KKdQt9FQ/19f6430f-ca72-4154-8998-ede6be4542c7-837",
|
76
|
+
"host_key": "533895",
|
77
|
+
"jid": "kdykjnimt4kpd8kkdqt9fq@xmpp.zoom.us",
|
78
|
+
"group_ids": [],
|
79
|
+
"im_group_ids": [
|
80
|
+
"3NXCD9VFTCOUH8LD-QciGw"
|
81
|
+
],
|
82
|
+
"account_id": "gVcjZnYYRLDbb_MfgHuaxg",
|
83
|
+
"language": "en-US",
|
84
|
+
"phone_country": "US",
|
85
|
+
"phone_number": "+1 1234567891",
|
86
|
+
"status": "active"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
46
91
|
```
|
47
92
|
|
48
93
|
## Contributing
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'base64'
|
4
|
+
require 'oauth2'
|
3
5
|
require 'omniauth-oauth2'
|
4
6
|
|
5
7
|
module OmniAuth
|
6
8
|
module Strategies
|
7
9
|
class Zoom < OmniAuth::Strategies::OAuth2
|
8
10
|
option :name, 'zoom'
|
9
|
-
option :client_options, site: 'https://zoom.us'
|
10
|
-
authorize_url: '/oauth/authorize',
|
11
|
-
token_url: '/oauth/token'
|
11
|
+
option :client_options, site: 'https://zoom.us'
|
12
12
|
|
13
13
|
uid { raw_info[:id] }
|
14
14
|
|
@@ -16,16 +16,41 @@ module OmniAuth
|
|
16
16
|
{ raw_info: raw_info }
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
return @raw_info unless @raw_info.nil?
|
19
|
+
protected
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
def build_access_token
|
22
|
+
params = {
|
23
|
+
grant_type: 'authorization_code',
|
24
|
+
code: request.params['code'],
|
25
|
+
redirect_uri: callback_url
|
26
|
+
}
|
27
|
+
path = "#{client.options[:token_url]}?#{params.to_query}"
|
28
|
+
token = Base64.strict_encode64("#{client.id}:#{client.secret}")
|
29
|
+
opts = { headers: { Authorization: "Basic #{token}" } }
|
30
|
+
|
31
|
+
response = client.request(:post, path, opts)
|
32
|
+
access_token_opts = response.parsed.merge(deep_symbolize(options.auth_token_params))
|
33
|
+
::OAuth2::AccessToken.from_hash(client, access_token_opts).tap do |access_token|
|
34
|
+
if access_token.respond_to?(:response=)
|
35
|
+
access_token.response = response
|
36
|
+
end
|
37
|
+
end
|
24
38
|
end
|
25
39
|
|
26
40
|
def callback_url
|
27
41
|
full_host + script_name + callback_path
|
28
42
|
end
|
43
|
+
|
44
|
+
def raw_info
|
45
|
+
return @raw_info unless @raw_info.nil?
|
46
|
+
|
47
|
+
res = access_token.get('/v2/users/me')
|
48
|
+
@raw_info = JSON.parse(res.body, symbolize_names: true)
|
49
|
+
rescue StandardError => e
|
50
|
+
logger = OmniAuth.config.logger
|
51
|
+
logger&.debug("#{self.class}.#{__method__} #{e.class} occured. message:#{e.message}")
|
52
|
+
@raw_info = {}
|
53
|
+
end
|
29
54
|
end
|
30
55
|
end
|
31
56
|
end
|
data/omniauth-zoom.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
+
spec.add_runtime_dependency 'oauth2', '~> 1.4.4'
|
31
32
|
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6.0'
|
32
33
|
|
33
34
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-zoom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Koshikawa
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.4.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.4
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: omniauth-oauth2
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,6 +132,7 @@ files:
|
|
118
132
|
- ".github/workflows/gem-push.yml"
|
119
133
|
- ".github/workflows/test.yml"
|
120
134
|
- ".gitignore"
|
135
|
+
- CHANGELOG.md
|
121
136
|
- CODE_OF_CONDUCT.md
|
122
137
|
- Gemfile
|
123
138
|
- LICENSE.txt
|
@@ -136,7 +151,7 @@ metadata:
|
|
136
151
|
homepage_uri: https://github.com/koshilife/omniauth-zoom
|
137
152
|
source_code_uri: https://github.com/koshilife/omniauth-zoom
|
138
153
|
changelog_uri: https://github.com/koshilife/omniauth-zoom/blob/master/CHANGELOG.md
|
139
|
-
documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.0
|
154
|
+
documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.1.0
|
140
155
|
post_install_message:
|
141
156
|
rdoc_options: []
|
142
157
|
require_paths:
|