omniauth-webflow 0.2.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ad987f587504fabb5720eaa3477450f4670cf147e98b5fb9daaf104250e7823
4
- data.tar.gz: 4e6d2c5c10ff603dd00fc10fc4708510cc6b94ddc5c7948ffb381913b0569245
3
+ metadata.gz: a64baaf2173308ad1706605ad3dfb4147ce16d07201517574aba75b1204f0510
4
+ data.tar.gz: 2fc84632f006e91cd8c35130c4d54cff3330875ef219288754da2a6de9150c7c
5
5
  SHA512:
6
- metadata.gz: 4dc8f3bf741a1a3c153e95ebaf740e33d544d8a4e7e3e24d98e92a6b17221200ad44f851a5f08dc67f6eaa16683f33c2542e8f59fc18bc01791436c4a2de5d89
7
- data.tar.gz: fc3d3ec53a6486a2bfbef7ace67e037bdc97db38ec72f9055ba5ae4c7240b50ccd8f09eb2c3e3d7270fc67fb24c4d91468e9bb7861a45a07a8bf001411579993
6
+ metadata.gz: 8e3fd536754d099a2f669c29ee3efb382a7877540f87bbede0592245c84cae27bfc1472fb142e9e547b066fe964de19528f9308ce667f933d6b35b3347c72665
7
+ data.tar.gz: 593876f74cd6e103662fdfc31cc1642cc68c1dcd47f30bce176337c9cacda13ef058fd9192b07fe4d4e1982642943f3c0480021d49546731db8b6c051ae0bc01
data/Gemfile.lock CHANGED
@@ -1,53 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-webflow (0.2.1)
4
+ omniauth-webflow (1.0.0)
5
5
  multi_json (~> 1.15)
6
6
  omniauth-oauth2 (~> 1.7)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ base64 (0.2.0)
11
12
  diff-lcs (1.3)
12
- faraday (1.8.0)
13
- faraday-em_http (~> 1.0)
14
- faraday-em_synchrony (~> 1.0)
15
- faraday-excon (~> 1.1)
16
- faraday-httpclient (~> 1.0.1)
17
- faraday-net_http (~> 1.0)
18
- faraday-net_http_persistent (~> 1.1)
19
- faraday-patron (~> 1.0)
20
- faraday-rack (~> 1.0)
21
- multipart-post (>= 1.2, < 3)
13
+ faraday (2.8.1)
14
+ base64
15
+ faraday-net_http (>= 2.0, < 3.1)
22
16
  ruby2_keywords (>= 0.0.4)
23
- faraday-em_http (1.0.0)
24
- faraday-em_synchrony (1.0.0)
25
- faraday-excon (1.1.0)
26
- faraday-httpclient (1.0.1)
27
- faraday-net_http (1.0.1)
28
- faraday-net_http_persistent (1.2.0)
29
- faraday-patron (1.0.0)
30
- faraday-rack (1.0.0)
17
+ faraday-net_http (3.0.2)
31
18
  hashie (5.0.0)
32
- jwt (2.3.0)
19
+ jwt (2.9.3)
20
+ base64
33
21
  multi_json (1.15.0)
34
22
  multi_xml (0.6.0)
35
- multipart-post (2.1.1)
36
- oauth2 (1.4.7)
37
- faraday (>= 0.8, < 2.0)
23
+ oauth2 (2.0.9)
24
+ faraday (>= 0.17.3, < 3.0)
38
25
  jwt (>= 1.0, < 3.0)
39
- multi_json (~> 1.3)
40
26
  multi_xml (~> 0.5)
41
- rack (>= 1.2, < 3)
42
- omniauth (2.0.4)
27
+ rack (>= 1.2, < 4)
28
+ snaky_hash (~> 2.0)
29
+ version_gem (~> 1.1)
30
+ omniauth (2.1.2)
43
31
  hashie (>= 3.4.6)
44
- rack (>= 1.6.2, < 3)
32
+ rack (>= 2.2.3)
45
33
  rack-protection
46
- omniauth-oauth2 (1.7.2)
47
- oauth2 (~> 1.4)
48
- omniauth (>= 1.9, < 3)
49
- rack (2.2.3)
50
- rack-protection (2.1.0)
34
+ omniauth-oauth2 (1.8.0)
35
+ oauth2 (>= 1.4, < 3)
36
+ omniauth (~> 2.0)
37
+ rack (3.1.8)
38
+ rack-protection (3.0.6)
51
39
  rack
52
40
  rake (12.3.3)
53
41
  rspec (3.9.0)
@@ -64,6 +52,10 @@ GEM
64
52
  rspec-support (~> 3.9.0)
65
53
  rspec-support (3.9.3)
66
54
  ruby2_keywords (0.0.5)
55
+ snaky_hash (2.0.1)
56
+ hashie
57
+ version_gem (~> 1.1, >= 1.1.1)
58
+ version_gem (1.1.4)
67
59
 
68
60
  PLATFORMS
69
61
  ruby
@@ -74,4 +66,4 @@ DEPENDENCIES
74
66
  rspec (~> 3.0)
75
67
 
76
68
  BUNDLED WITH
77
- 2.1.2
69
+ 2.2.27
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # omniauth-webflow
2
2
 
3
- This gem is an [OmniAuth 1.0](https://github.com/omniauth/omniauth) Strategy for authenticating with the [Webflow API](https://developers.webflow.com/) (version 1.0.0)
3
+ This gem is an [OmniAuth](https://github.com/omniauth/omniauth) Strategy for authenticating with the [Webflow API](https://developers.webflow.com/v2.0.0) (Data API version 2.0.0)
4
4
 
5
5
  ## Setup
6
6
 
@@ -17,7 +17,7 @@ After registering a new application with Webflow take note of the `client_id` an
17
17
  Add this line to your application's Gemfile:
18
18
 
19
19
  ```ruby
20
- gem 'omniauth-webflow'
20
+ gem 'omniauth-webflow' ~> 1.0.0
21
21
  ```
22
22
 
23
23
  And then execute:
@@ -28,9 +28,11 @@ In your Rails app, add the Webflow provider to your Omniauth middleware, e.g. in
28
28
 
29
29
  ```ruby
30
30
  Rails.application.config.middleware.use OmniAuth::Builder do
31
- provider :webflow, ENV['WEBFLOW_CLIENT_ID'], ENV['WEBFLOW_CLIENT_SECRET']
31
+ provider :webflow, ENV['WEBFLOW_CLIENT_ID'], ENV['WEBFLOW_CLIENT_SECRET'],
32
+ scope: 'authorized_user:read sites:read' # this is an example scope
32
33
  end
33
34
  ```
35
+ Specify [scopes](https://docs.developers.webflow.com/reference/scopes) as required.
34
36
 
35
37
  ## Contributing
36
38
 
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-oauth2'
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class Webflow < OmniAuth::Strategies::OAuth2
6
- API_VERSION = '1.0.0'.freeze
7
-
8
8
  option :name, 'webflow'
9
9
  option :client_options, {
10
10
  site: 'https://api.webflow.com',
@@ -12,15 +12,12 @@ module OmniAuth
12
12
  token_url: 'https://api.webflow.com/oauth/access_token'
13
13
  }
14
14
 
15
- uid { raw_info['_id'] }
15
+ uid { raw_info['authorization']['id'] }
16
16
 
17
17
  info do
18
18
  {
19
- id: raw_info['_id'],
20
- grant_type: raw_info['grantType'],
21
- users: raw_info['users'],
22
- orgs: raw_info['orgs'],
23
- sites: raw_info['sites']
19
+ id: raw_info['authorization']['id'],
20
+ grant_type: raw_info['authorization']['grantType']
24
21
  }
25
22
  end
26
23
 
@@ -31,19 +28,13 @@ module OmniAuth
31
28
  end
32
29
 
33
30
  def raw_info
34
- @raw_info ||= access_token.get("https://api.webflow.com/info?api_version=#{API_VERSION}").parsed
31
+ @raw_info ||= access_token.get('https://api.webflow.com/v2/token/introspect').parsed
35
32
  end
36
33
 
37
- protected
38
-
39
- # callback_url includes the code parameter and Webflow decided to change their API recently
40
- # to require the redirect_uri to match exactly what you have in your Webflow Application settings.
41
- # This also means that you can not pass other url parameters through the redirect_uri.
42
- def build_access_token
43
- verifier = request.params['code']
44
- uri = Addressable::URI.parse(callback_url)
45
- redirect_uri = uri.omit(:query).to_s
46
- client.auth_code.get_token(verifier, { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true)), deep_symbolize(options.auth_token_params))
34
+ # The Webflow API requires the redirect_uri to match exactly what you have in your Webflow Application settings
35
+ # This method ensures any query params are removed before the build_access_token step occurs
36
+ def callback_url
37
+ full_host + callback_path
47
38
  end
48
39
  end
49
40
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Webflow
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '1.0.0'.freeze
4
4
  end
5
5
  end
@@ -27,9 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- # spec.add_runtime_dependency 'omniauth-oauth2'
31
- # spec.add_runtime_dependency 'multi_json'
32
-
33
30
  spec.add_dependency 'omniauth-oauth2', '~> 1.7'
34
31
  spec.add_dependency 'multi_json', '~> 1.15'
35
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-webflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2024-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2