omniauth-hubspot 0.1.0 → 0.1.1

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
2
  SHA1:
3
- metadata.gz: 85466945e88f5ac89215914ea919cdd8e48d0c0d
4
- data.tar.gz: 6ff4963e5e437a51b2038ee0f382205e29efb874
3
+ metadata.gz: 249b3d1775295254324b7d14b5678ce1aa83e9fa
4
+ data.tar.gz: c00e30697540398d0b7c437ec5b8469be47fd691
5
5
  SHA512:
6
- metadata.gz: 43b14658e1d6987e3b2b1948a62d591303751acb1451401a530e01e0f1d5252395f0a02d2d05b6d82ecd9d06225f311a253ebb355fafbcfc106faade3099c6a2
7
- data.tar.gz: 39d151e71e3a8d4b8d37fde88394d10ec705ff4847d0d604cd1f2bf4b03025bd886e487e86187aeea4b4440881f1306e9eff2471883d145f9535e95e73974555
6
+ metadata.gz: 0c23e4481907c3e2eec6f7f3268bf424c9aa453bbe6cfc3eeee3811e12c5521a4ac3cb5bfb89b68ceaa46d355bc9f9d87a0c1da409502b4e3bac7f887dc079e2
7
+ data.tar.gz: 0a6a8ce7068c86168e9da5ab4808119ebbbb831f284ac54b0850fa7b88d3242af9d59f706d1cd05af3cfb1da9e349cd5a49e76ba7ba9adf83e6ed9e75c88c859
data/README.md CHANGED
@@ -1,4 +1,47 @@
1
- omniauth-hubspot
1
+ OmniAuth HubSpot
2
2
  ================
3
3
 
4
4
  An OmniAuth strategy for authenticating with the HubSpot API.
5
+
6
+ ## Peculiarities
7
+
8
+ HubSpot has some peculiarities in their implementation of OAuth that I've accounted for in this strategy. Be aware that the authorization process does not use OAuth2's state parameter for securing sessions. Additionally, it does not use the POST to token URL phase of OAuth; instead, the tokens we need are passed as parameters right after the initial request phase. HubSpot also authenticates with only a Client ID and a Portal ID, instead of the standard Client ID and Client Secret.
9
+
10
+ ## Installing
11
+
12
+ Add the gem to your `Gemfile` and then `bundle install`.
13
+
14
+ ```ruby
15
+ gem 'omniauth-hubspot'
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You will need to define a custom [setup phase](https://github.com/intridea/omniauth/wiki/Setup-Phase) for this strategy to work. This is because [HubSpot requires a `portalId` to be set](https://developers.hubspot.com/auth/oauth_apps), which is customer-specific and therefore cannot be simply passed as a parameter to provider. The above setup phase link should give you an idea of the different ways to do this. My setup phase code looks roughly like the following.
21
+
22
+ ```ruby
23
+ def setup
24
+ request.env['omniauth.strategy'].options[:portalId] = params[:hubspot][:portal_id]
25
+
26
+ render text: "Omniauth setup phase.", status: 404
27
+ end
28
+ ```
29
+
30
+ If you are using multiple providers, you'll want to wrap an if statement around that so that you only set it when you're using HubSpot.
31
+
32
+ Then, when adding the provider to your `omniauth.rb`, you will only need to specify a `client_id` and a `scope`. HubSpot's supported scopes are [here](https://developers.hubspot.com/auth/oauth_scopes). Note that although the documentation states to separate scopes with a `+`, you will actually need to use a space, as this is escaped into a `+`. Here is an example provider line:
33
+
34
+ ```ruby
35
+ provider :hubspot, ENV['HUBSPOT_CLIENT_ID'], setup: true, scope: "contacts-rw offline"
36
+ ```
37
+
38
+ Be sure to specify the `offline` scope if you want to get a refresh token that you can use to renew your access token.
39
+
40
+ ## Contributing
41
+
42
+ Fork, create a branch, and create a pull request when you're done.
43
+
44
+ ## License
45
+
46
+ Copyright (C) 2014 Daniel Arnold
47
+ GPL v3.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module HubSpot
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-hubspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Arnold