omniauth-zalo 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 +4 -4
- data/lib/omniauth/strategies/zalo.rb +17 -16
- data/lib/omniauth/zalo/version.rb +1 -1
- data/omniauth-zalo-0.1.2.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6907ed2eadfb1a261cb6a4085d1c30089dff64c
|
4
|
+
data.tar.gz: 474cade29f7d25d2db684af9dc36e08b3cb21007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 558a6cdf1b070b43bc8aa72f7b3b9dbfc83709cfe993b1ce5a032859f1ed1f003d5e68902bc976c3ea67fd9a80b8bcadc02a830cb0fe17eafedc27f7417381cc
|
7
|
+
data.tar.gz: c2da4e586a5c9a9bb445601b333f9fc3f321605e93e944a1a7d45b1f1d279e0bfdf6ede88cbb367a594d622e85fbb65ac7cfa6073aca8f440329f00f36511d6e
|
@@ -10,16 +10,17 @@ module OmniAuth
|
|
10
10
|
site: 'https://oauth.zaloapp.com',
|
11
11
|
authorize_url: '/v3/auth',
|
12
12
|
token_url: '/v3/access_token',
|
13
|
-
token_method: :get
|
13
|
+
token_method: :get,
|
14
14
|
}
|
15
15
|
|
16
|
-
|
16
|
+
option :provider_ignores_state, true
|
17
|
+
|
18
|
+
uid { raw_info['id'] }
|
17
19
|
|
18
20
|
info do
|
19
21
|
{
|
20
|
-
name:
|
21
|
-
image:
|
22
|
-
description: raw_info['statusMessage']
|
22
|
+
name: raw_info['name'],
|
23
|
+
image: raw_info['picture']['data']['url'],
|
23
24
|
}
|
24
25
|
end
|
25
26
|
|
@@ -27,6 +28,16 @@ module OmniAuth
|
|
27
28
|
super.merge(app_id: self.options.client_id)
|
28
29
|
end
|
29
30
|
|
31
|
+
def build_access_token
|
32
|
+
token_url_params = {app_id: options.client_id, app_secret: options.client_secret, code: request.params['code'], redirect_uri: callback_url}.merge(token_params.to_hash(:symbolize_keys => true))
|
33
|
+
parsed_response = client.request(options.client_options.token_method, client.token_url(token_url_params), parse: :json).parsed
|
34
|
+
hash = {
|
35
|
+
:access_token => parsed_response["access_token"],
|
36
|
+
:expires_in => parsed_response["expires_in"],
|
37
|
+
}
|
38
|
+
::OAuth2::AccessToken.from_hash(client, hash)
|
39
|
+
end
|
40
|
+
|
30
41
|
alias :old_callback_url :callback_url
|
31
42
|
|
32
43
|
def callback_url
|
@@ -37,18 +48,8 @@ module OmniAuth
|
|
37
48
|
end
|
38
49
|
end
|
39
50
|
|
40
|
-
def callback_path
|
41
|
-
params = session['omniauth.params']
|
42
|
-
|
43
|
-
if params.nil? || params['callback_url'].nil?
|
44
|
-
super
|
45
|
-
else
|
46
|
-
URI(params['callback_url']).path
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
51
|
def raw_info
|
51
|
-
@raw_info ||= JSON.load(access_token.get(
|
52
|
+
@raw_info ||= JSON.load(access_token.get("https://graph.zalo.me/v2.0/me?access_token=#{access_token.token}&fields=id,birthday,name,gender,picture,phone").body)
|
52
53
|
rescue ::Errno::ETIMEDOUT
|
53
54
|
raise ::Timeout::Error
|
54
55
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-zalo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nguyenthanhcong101096
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/omniauth/zalo/version.rb
|
81
81
|
- omniauth-zalo-0.1.0.gem
|
82
82
|
- omniauth-zalo-0.1.1.gem
|
83
|
+
- omniauth-zalo-0.1.2.gem
|
83
84
|
- omniauth-zalo.gemspec
|
84
85
|
homepage: https://github.com/nguyenthanhcong101096/omniauth-zalo
|
85
86
|
licenses:
|