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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30740d3b00ef67d9af52350a8ae7523b1f5a5431
4
- data.tar.gz: 66443d4bc30f181a326472f72c19d4ff714f883f
3
+ metadata.gz: e6907ed2eadfb1a261cb6a4085d1c30089dff64c
4
+ data.tar.gz: 474cade29f7d25d2db684af9dc36e08b3cb21007
5
5
  SHA512:
6
- metadata.gz: 1200ff766fcf66f85d0c6aefcce9b6dda5632757a929493a699cd8bef99ee7addfbb8bc11b3b6613e83f1f08c8b930e9c0132aa26f90b0ee5325a64cc5b9d348
7
- data.tar.gz: 0c19e9ce61ba54472f224e74b20372859d8c507729bf210ee799a97f4eab754aaad4dcaf3f651ee3575fa3a852021da117e9d330ae60603af65e2f229d01a761
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
- uid { raw_info['userId'] }
16
+ option :provider_ignores_state, true
17
+
18
+ uid { raw_info['id'] }
17
19
 
18
20
  info do
19
21
  {
20
- name: raw_info['displayName'],
21
- image: raw_info['pictureUrl'],
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('https://graph.zalo.me/v2.0/me').body)
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
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Zalo
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.2
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: