omniauth-intercom 0.1.1 → 0.1.2
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 +7 -1
- data/README.md +4 -4
- data/lib/omniauth/intercom/version.rb +1 -1
- data/lib/omniauth/strategies/intercom.rb +11 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfacd27e923da6ff12e6fa19596a8da33b0b536c
|
4
|
+
data.tar.gz: d5d22d9023725fb0c148b3626eac0de441fe1a0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0585d860eb475bf66ce0099de68143d8d60e9a94098992a6d4ca645937b2029828f9c4c24435cc51d13e232d79f18071c3c80f73a30e8b9321611e7ceab0c24d
|
7
|
+
data.tar.gz: 300f09777d0919b3a88cf1994dbc02886a37f2d11695a1ecce568b4f2dca54aaeba665c458f5f6742c524dd223af78e499320577cf1c854b1a4e5bdd242ad6a7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# OmniAuth Intercom
|
3
2
|
|
4
3
|
Intercom OAuth2 Strategy for OmniAuth.
|
@@ -29,7 +28,7 @@ end
|
|
29
28
|
To start the authentication process with Intercom you simply need to access `/auth/intercom` route.
|
30
29
|
You can start the authentication process directly with the signup page by accessing `/auth/intercom?signup=1`
|
31
30
|
|
32
|
-
**Important** You need the `
|
31
|
+
**Important** You need the `read_single_admin` permissions to use this middleware.
|
33
32
|
**Important** Your `redirect_url` should be `/auth/intercom/callback`
|
34
33
|
|
35
34
|
## Auth Hash
|
@@ -56,8 +55,9 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
56
55
|
:id => '342324',
|
57
56
|
:app => {
|
58
57
|
:id_code => 'abc123', # Company app_id
|
59
|
-
:type
|
60
|
-
|
58
|
+
:type => 'app',
|
59
|
+
:secure => true # Secure mode enabled for this app
|
60
|
+
},
|
61
61
|
:avatar => {
|
62
62
|
:image_url => "https://static.intercomassets.com/avatars/343616/square_128/me.jpg?1454165491"
|
63
63
|
}
|
@@ -2,35 +2,30 @@ require 'omniauth-oauth2'
|
|
2
2
|
module OmniAuth
|
3
3
|
module Strategies
|
4
4
|
class Intercom < OmniAuth::Strategies::OAuth2
|
5
|
-
|
6
|
-
option :name, "intercom"
|
5
|
+
option :name, 'intercom'
|
7
6
|
|
8
|
-
# This is where you pass the options you would pass when
|
9
|
-
# initializing your consumer from the OAuth gem.
|
10
7
|
option :client_options, {
|
11
8
|
:site => 'https://api.intercom.io',
|
12
|
-
# :site => 'http://localhost:4000',
|
13
9
|
:authorize_url => 'https://app.intercom.io/oauth',
|
14
10
|
:token_url => 'https://api.intercom.io/auth/eagle/token'
|
15
11
|
}
|
16
12
|
|
17
|
-
|
18
|
-
# possible, you should try to set the UID without making
|
19
|
-
# additional calls (if the user id is returned with the token
|
20
|
-
# or as a URI parameter). This may not be possible with all
|
21
|
-
# providers.
|
22
|
-
uid{ raw_info['id'] }
|
13
|
+
uid { raw_info['id'] }
|
23
14
|
|
24
15
|
info do
|
25
16
|
{
|
26
17
|
:name => raw_info['name'],
|
27
|
-
:email => raw_info['email']
|
28
|
-
}
|
18
|
+
:email => raw_info['email'],
|
19
|
+
}.tap do |info|
|
20
|
+
avatar = raw_info['avatar'] && raw_info['avatar']['image_url']
|
21
|
+
|
22
|
+
info[:image] = avatar if avatar
|
23
|
+
end
|
29
24
|
end
|
30
25
|
|
31
26
|
extra do
|
32
27
|
{
|
33
|
-
|
28
|
+
:raw_info => raw_info
|
34
29
|
}
|
35
30
|
end
|
36
31
|
|
@@ -41,16 +36,13 @@ module OmniAuth
|
|
41
36
|
end
|
42
37
|
|
43
38
|
def request_phase
|
44
|
-
authorize_url
|
39
|
+
options.client_options[:authorize_url] += '/signup' if request.params.fetch('signup', false)
|
40
|
+
|
45
41
|
super
|
46
42
|
end
|
47
43
|
|
48
44
|
protected
|
49
45
|
|
50
|
-
def authorize_url
|
51
|
-
options.client_options[:authorize_url] += '/signup' if request.params.fetch('signup', false)
|
52
|
-
end
|
53
|
-
|
54
46
|
def accept_headers
|
55
47
|
access_token.client.connection.headers['Authorization'] = access_token.client.connection.basic_auth(access_token.token, '')
|
56
48
|
access_token.client.connection.headers['Accept'] = "application/vnd.intercom.3+json"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-intercom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Antoine
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|