omniauth-webflow 0.1.0 → 0.2.1

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: 0fed9cba5d4964c45b457465ccefad47c7dc6aeffaaf955b900c4e4c486822f3
4
- data.tar.gz: add603d9545e3a6adf19c4eabaa38dd1db899fcee1e4ca4975548ab9296fd428
3
+ metadata.gz: 4ad987f587504fabb5720eaa3477450f4670cf147e98b5fb9daaf104250e7823
4
+ data.tar.gz: 4e6d2c5c10ff603dd00fc10fc4708510cc6b94ddc5c7948ffb381913b0569245
5
5
  SHA512:
6
- metadata.gz: e85ff27f24d19aa6333f0b0438c20b877c832ec29335e3bba02c7d87e12ff8d0720e4985efb8051c94202b18a7180a364e3e1490c7fc3bd960c1fd5dc6d638aa
7
- data.tar.gz: cd66baa06ddbdd1140404fda5ebf414a6def345693178daf2a47ac871c40b9fd81da050d28f45f94e46f13f30a45ac08576519b875abce0ba9a12b431d6562d1
6
+ metadata.gz: 4dc8f3bf741a1a3c153e95ebaf740e33d544d8a4e7e3e24d98e92a6b17221200ad44f851a5f08dc67f6eaa16683f33c2542e8f59fc18bc01791436c4a2de5d89
7
+ data.tar.gz: fc3d3ec53a6486a2bfbef7ace67e037bdc97db38ec72f9055ba5ae4c7240b50ccd8f09eb2c3e3d7270fc67fb24c4d91468e9bb7861a45a07a8bf001411579993
data/Development.md ADDED
@@ -0,0 +1,7 @@
1
+ Build the gem
2
+
3
+ gem build omniauth-webflow.gemspec
4
+
5
+ Then publish the gem
6
+
7
+ bundle exec rake release
data/Gemfile.lock CHANGED
@@ -1,34 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-webflow (0.1.0)
5
- multi_json (= 1.14.1)
6
- omniauth-oauth2 (= 1.6.0)
4
+ omniauth-webflow (0.2.1)
5
+ multi_json (~> 1.15)
6
+ omniauth-oauth2 (~> 1.7)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  diff-lcs (1.3)
12
- faraday (1.0.1)
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)
13
21
  multipart-post (>= 1.2, < 3)
14
- hashie (4.1.0)
15
- jwt (2.2.1)
16
- multi_json (1.14.1)
22
+ 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)
31
+ hashie (5.0.0)
32
+ jwt (2.3.0)
33
+ multi_json (1.15.0)
17
34
  multi_xml (0.6.0)
18
35
  multipart-post (2.1.1)
19
- oauth2 (1.4.4)
36
+ oauth2 (1.4.7)
20
37
  faraday (>= 0.8, < 2.0)
21
38
  jwt (>= 1.0, < 3.0)
22
39
  multi_json (~> 1.3)
23
40
  multi_xml (~> 0.5)
24
41
  rack (>= 1.2, < 3)
25
- omniauth (1.9.1)
42
+ omniauth (2.0.4)
26
43
  hashie (>= 3.4.6)
27
44
  rack (>= 1.6.2, < 3)
28
- omniauth-oauth2 (1.6.0)
29
- oauth2 (~> 1.1)
30
- omniauth (~> 1.9)
31
- rack (2.2.2)
45
+ 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)
51
+ rack
32
52
  rake (12.3.3)
33
53
  rspec (3.9.0)
34
54
  rspec-core (~> 3.9.0)
@@ -43,6 +63,7 @@ GEM
43
63
  diff-lcs (>= 1.2.0, < 2.0)
44
64
  rspec-support (~> 3.9.0)
45
65
  rspec-support (3.9.3)
66
+ ruby2_keywords (0.0.5)
46
67
 
47
68
  PLATFORMS
48
69
  ruby
data/README.md CHANGED
@@ -1,10 +1,18 @@
1
- # Omniauth::Webflow
1
+ # omniauth-webflow
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/webflow`. To experiment with that code, run `bin/console` for an interactive prompt.
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)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Setup
6
6
 
7
- ## Installation
7
+ First, you will need to register your application with Webflow. This can be done on the [Integrations](https://webflow.com/dashboard/account/integrations) tab.
8
+
9
+ **Important:** your callback URL should be specified as `https://[hostname]/auth/webflow/callback`
10
+
11
+ In order to authenticate with Webflow in both development and production we recommend registering a "-dev" app with Webflow that points at your localhost app. One thing to note here is that Webflow requires your callback url to be `https`.
12
+
13
+ After registering a new application with Webflow take note of the `client_id` and `client_secret` provided. You should put these into your Rails credentials or store them as environment variables like `ENV['WEBFLOW_CLIENT_ID']` and `ENV['WEBFLOW_CLIENT_SECRET']`
14
+
15
+ ## Usage
8
16
 
9
17
  Add this line to your application's Gemfile:
10
18
 
@@ -16,24 +24,17 @@ And then execute:
16
24
 
17
25
  $ bundle install
18
26
 
19
- Or install it yourself as:
20
-
21
- $ gem install omniauth-webflow
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
27
+ In your Rails app, add the Webflow provider to your Omniauth middleware, e.g. in a file like `config/initializers/omniauth.rb`:
30
28
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ provider :webflow, ENV['WEBFLOW_CLIENT_ID'], ENV['WEBFLOW_CLIENT_SECRET']
32
+ end
33
+ ```
32
34
 
33
35
  ## Contributing
34
36
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-webflow. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/omniauth-webflow/blob/master/CODE_OF_CONDUCT.md).
36
-
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wrk-corp/omniauth-webflow. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/wrk-corp/omniauth-webflow/blob/master/CODE_OF_CONDUCT.md).
37
38
 
38
39
  ## License
39
40
 
@@ -41,4 +42,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
41
42
 
42
43
  ## Code of Conduct
43
44
 
44
- Everyone interacting in the Omniauth::Webflow project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omniauth-webflow/blob/master/CODE_OF_CONDUCT.md).
45
+ Everyone interacting in the Omniauth::Webflow project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wrk-corp/omniauth-webflow/blob/master/CODE_OF_CONDUCT.md).
@@ -3,26 +3,24 @@ require 'omniauth-oauth2'
3
3
  module OmniAuth
4
4
  module Strategies
5
5
  class Webflow < OmniAuth::Strategies::OAuth2
6
- API_VERSION = "1.0.0"
6
+ API_VERSION = '1.0.0'.freeze
7
7
 
8
- option :name, "webflow"
8
+ option :name, 'webflow'
9
9
  option :client_options, {
10
- site: "https://api.webflow.com",
10
+ site: 'https://api.webflow.com',
11
11
  authorize_url: 'https://webflow.com/oauth/authorize',
12
12
  token_url: 'https://api.webflow.com/oauth/access_token'
13
13
  }
14
- # option :token_params, { parse: :json }
15
- # option :auth_token_params, { mode: :query, param_name: :token }
16
14
 
17
15
  uid { raw_info['_id'] }
18
16
 
19
17
  info do
20
18
  {
21
- id: raw_info["_id"],
22
- grant_type: raw_info["grantType"],
23
- users: raw_info["users"],
24
- orgs: raw_info["orgs"],
25
- sites: raw_info["sites"],
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']
26
24
  }
27
25
  end
28
26
 
@@ -36,14 +34,17 @@ module OmniAuth
36
34
  @raw_info ||= access_token.get("https://api.webflow.com/info?api_version=#{API_VERSION}").parsed
37
35
  end
38
36
 
39
- protected
37
+ protected
40
38
 
41
- # had to override this method as it was merging the redirect_uri into the params which was breaking the Webflow /access_token request
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
42
  def build_access_token
43
- verifier = request.params["code"]
44
- client.auth_code.get_token(verifier, token_params.to_hash(:symbolize_keys => true), deep_symbolize(options.auth_token_params))
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))
45
47
  end
46
-
47
48
  end
48
49
  end
49
- end
50
+ end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Webflow
3
- VERSION = "0.1.0"
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
@@ -1,35 +1,35 @@
1
1
  require_relative 'lib/omniauth-webflow/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = "omniauth-webflow"
4
+ spec.name = 'omniauth-webflow'
5
5
  spec.version = Omniauth::Webflow::VERSION
6
- spec.authors = ["Andrew"]
7
- spec.email = ["andrew@wrkhq.com"]
6
+ spec.authors = ['Andrew']
7
+ spec.email = ['andrew@wrkhq.com']
8
8
 
9
- spec.summary = %q{Omniauth strategy for Webflow}
10
- spec.description = %q{Omniauth strategy for Webflow}
11
- spec.homepage = "https://github.com/wrk-corp/omniauth-webflow"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
9
+ spec.summary = 'Omniauth strategy for Webflow'
10
+ spec.description = 'Omniauth strategy for Webflow'
11
+ spec.homepage = 'https://github.com/wrk-corp/omniauth-webflow'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
14
 
15
15
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
16
 
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = "https://github.com/wrk-corp/omniauth-webflow"
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/wrk-corp/omniauth-webflow'
19
19
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
  end
26
- spec.bindir = "exe"
26
+ spec.bindir = 'exe'
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
29
29
 
30
30
  # spec.add_runtime_dependency 'omniauth-oauth2'
31
31
  # spec.add_runtime_dependency 'multi_json'
32
32
 
33
- spec.add_dependency 'omniauth-oauth2', '~> 1.6.0'
34
- spec.add_dependency 'multi_json', '~> 1.13.1'
33
+ spec.add_dependency 'omniauth-oauth2', '~> 1.7'
34
+ spec.add_dependency 'multi_json', '~> 1.15'
35
35
  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.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-09 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.0
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.13.1
33
+ version: '1.15'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.13.1
40
+ version: '1.15'
41
41
  description: Omniauth strategy for Webflow
42
42
  email:
43
43
  - andrew@wrkhq.com
@@ -51,6 +51,7 @@ files:
51
51
  - ".ruby-version"
52
52
  - ".travis.yml"
53
53
  - CODE_OF_CONDUCT.md
54
+ - Development.md
54
55
  - Gemfile
55
56
  - Gemfile.lock
56
57
  - LICENSE.txt
@@ -68,7 +69,7 @@ licenses:
68
69
  metadata:
69
70
  homepage_uri: https://github.com/wrk-corp/omniauth-webflow
70
71
  source_code_uri: https://github.com/wrk-corp/omniauth-webflow
71
- post_install_message:
72
+ post_install_message:
72
73
  rdoc_options: []
73
74
  require_paths:
74
75
  - lib
@@ -84,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
85
  version: '0'
85
86
  requirements: []
86
87
  rubygems_version: 3.1.2
87
- signing_key:
88
+ signing_key:
88
89
  specification_version: 4
89
90
  summary: Omniauth strategy for Webflow
90
91
  test_files: []