omniauth-heap 0.1.2 → 0.1.3

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: 555bf332f8e204e27a2534cd5f1eff604a00a8a836a633fd85503d9b6fd116ee
4
- data.tar.gz: 492e30d8ae6119b76d94ea2fd81c8ca05677bf43ed83e2e861a7d76e91472084
3
+ metadata.gz: 1afb58750b837bacc1303f45899784bc975b2c00f92ab43aae9cae2b9860fb50
4
+ data.tar.gz: 56e2d8dd24d8d15a626229a89963aafd52f936ff181861023c343c558c0ebbc0
5
5
  SHA512:
6
- metadata.gz: 6384e8e59fce88a5da7bb21ea3806ee2d63eba2bec41db5432459800f576826c4a53d838c93369477157e37162a6b0c26601526fcc3310a00edba32653060090
7
- data.tar.gz: 46785f37081a0a38af66ab933b1bbdb0ccc91f68df5c28a67fc2cfc67fbe25f597dbf6efd0acb4254846cb97d2a6ae3fe2e95230b1079a6e373a58882e1f42c6
6
+ metadata.gz: 5ef37b8e58a2bba05c73388abc12dc8690311f5dfdaefabf3bf875dc8046da9de2caa6291be8a6ec11ab79d985d93a9a01724699d48e9b6784eab431c706cc7a
7
+ data.tar.gz: 8b6d821491b6f09dd59f82ec3dd43a6a9d6be1f183b2c1415b3a315e569068d857977d9f8ddf17e2fe31bf6cb3e6ec89f9d81842edf62dad5d33121c0bb9af8e
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ omniauth-heap
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.2
data/README.md CHANGED
@@ -26,14 +26,14 @@ Rails.application.config.middleware.use OmniAuth::Builder do
26
26
  end
27
27
  ```
28
28
 
29
- `segment` is the only currently supported Scope
29
+ `segment` is the only currently supported Scope (as of Feb 2022)
30
30
 
31
31
  To start the authentication process with Heap you simply need to access `/auth/heap` route.
32
32
 
33
33
  ## Callback URL
34
34
 
35
35
  You define a callback URL in Heap that is matched 1-1 (no query string parameters allowed).
36
- To make sure the value entered into Heap matches exactly, define the callback URL as and environment variable.
36
+ To make sure the value entered into Heap matches exactly, define the callback URL as an environment variable.
37
37
 
38
38
  ```
39
39
  OAUTH_HEAP_CALLBACK_URL="https://auth.example.com/auth/heap/callback"
@@ -46,14 +46,23 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
46
46
  ```ruby
47
47
  {
48
48
  :provider => 'heap',
49
- :uid => nil,
49
+ :uid => 'fa267e34-ebd3-463f-92db-e065932cee90',
50
50
  :info => {
51
- :name => nil
51
+ :email => 'pam@example.co',
52
+ :env_id => '2544353',
52
53
  },
53
54
  :credentials => {
54
55
  :token => 'ehJy6IkiOiJFUzUxGcGnR5cMiXVCJ9.eyJqdGk47eiOiIc209c5eiJod431ce3272dd213a9...',
55
56
  :expires => false
56
57
  },
57
- :extra => { }
58
+ :extra => {
59
+ :raw_info => {
60
+ :env_id => '2544353',
61
+ :partner_app_id => '4',
62
+ :authorized_by => 'pam@example.co',
63
+ :authorized_scope => 'segment',
64
+ :authorized_at_utc => '2022-01-18T17:37:30.119148Z',
65
+ }
66
+ }
58
67
  }
59
68
  ```
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Heap
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -17,6 +17,25 @@ module OmniAuth
17
17
  grant_type: 'authorization_code'
18
18
  }
19
19
 
20
+ uid { access_token['id_token'] }
21
+
22
+ info do
23
+ {
24
+ email: raw_info['authorized_by'],
25
+ env_id: raw_info['env_id'],
26
+ }
27
+ end
28
+
29
+ extra do
30
+ {
31
+ raw_info: raw_info,
32
+ }
33
+ end
34
+
35
+ def raw_info
36
+ @raw_info ||= access_token.get("https://heapanalytics.com/api/partner/v1/metadata/#{access_token['id_token']}").parsed
37
+ end
38
+
20
39
  def callback_url
21
40
  ENV['OAUTH_HEAP_CALLBACK_URL'] || (full_host + script_name + callback_path)
22
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-heap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Norton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2022-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -60,6 +60,8 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
+ - ".ruby-gemset"
64
+ - ".ruby-version"
63
65
  - Gemfile
64
66
  - LICENSE
65
67
  - README.md