omniauth-wechat-oauth2 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 90919b05aecd6b3de0d6d41e1c0e18bac5abbc10d70a2d59c406a4acc139cb99
4
- data.tar.gz: 70f0b3689eabd805a81e15c4ecc7ea80e68c2f1dfde663472d8f74807b9aa5df
3
+ metadata.gz: b596173aeb57291ce355797589fca0a6d5dee5ac7f9aa733b98f24d6f140bcd4
4
+ data.tar.gz: f8cca424225ed5f3b21cff98adfb9fba811fc4a83564460a27eb9350d9240b9b
5
5
  SHA512:
6
- metadata.gz: ec12ab658d9e4a71ad8d7fee8af7e2a14d6884fb13fa92f70004becd5598bbffdc6a668b21089ef74d9e7a7c39e9138f2754f43eac7d67b5fadd8c3e133feef8
7
- data.tar.gz: 940c92c6ea780000f4b0a3cc1c207cee2828f2c7ae635825ae0e63a9ed1d32869de39fd75dfed0bef60f49675a95ec6900ca3e7ae0b8da8d902f62b19ae26f34
6
+ metadata.gz: 83052c403dd1113817c4d7025c8a51e80c546c3c75bc957e43f32af03a6636315c108b9c6a97ed3f4900aa3bf5545a76206d37a55820c3252624ece3313a6282
7
+ data.tar.gz: cae0c49e4f08e918b26e81992ff5758b3289de2d4596567efcb31a82ed19e102471b0b1bc792df821571251b47f0392b4ac5f907309c411f1bc4d85c1dd46a14
data/README.md CHANGED
@@ -5,7 +5,7 @@ Omniauth-wechat-oauth2
5
5
  [![Security Check](https://hakiri.io/github/NeverMin/omniauth-wechat-oauth2/master.svg)][security]
6
6
  [![Build Status](https://travis-ci.org/NeverMin/omniauth-wechat-oauth2.svg)][travis]
7
7
 
8
- [gem]: https://rubygems.org/gems/omniauth-weibo-oauth2
8
+ [gem]: https://rubygems.org/gems/omniauth-wechat-oauth2
9
9
  [security]: https://hakiri.io/github/NeverMin/omniauth-wechat-oauth2/master
10
10
  [travis]: https://travis-ci.org/NeverMin/omniauth-wechat-oauth2
11
11
 
@@ -7,15 +7,19 @@ module OmniAuth
7
7
 
8
8
  option :client_options, {
9
9
  site: "https://api.weixin.qq.com",
10
- authorize_url: "https://open.weixin.qq.com/connect/oauth2/authorize#wechat_redirect",
10
+ authorize_url: "https://open.weixin.qq.com/connect/qrconnect?#wechat_redirect",
11
11
  token_url: "/sns/oauth2/access_token",
12
12
  token_method: :get
13
13
  }
14
14
 
15
- option :authorize_params, {scope: "snsapi_userinfo"}
15
+ option :authorize_params, {scope: "snsapi_login"}
16
16
 
17
17
  option :token_params, {parse: :json}
18
18
 
19
+ def callback_url
20
+ full_host + script_name + callback_path
21
+ end
22
+
19
23
  uid do
20
24
  raw_info['openid']
21
25
  end
@@ -36,8 +40,9 @@ module OmniAuth
36
40
  end
37
41
 
38
42
  def request_phase
39
- params = client.auth_code.authorize_params.merge(redirect_uri: callback_url).merge(authorize_params)
43
+ params = client.auth_code.authorize_params.merge(authorize_params)
40
44
  params["appid"] = params.delete("client_id")
45
+ params["redirect_uri"] = callback_url
41
46
  redirect client.authorize_url(params)
42
47
  end
43
48
 
@@ -59,14 +64,15 @@ module OmniAuth
59
64
  protected
60
65
  def build_access_token
61
66
  params = {
62
- 'appid' => client.id,
63
- 'secret' => client.secret,
64
- 'code' => request.params['code'],
65
- 'grant_type' => 'authorization_code'
67
+ 'appid' => client.id,
68
+ 'secret' => client.secret,
69
+ 'code' => request.params['code'],
70
+ 'grant_type' => 'authorization_code',
71
+ 'redirect_uri' => callback_url
66
72
  }.merge(token_params.to_hash(symbolize_keys: true))
67
73
  client.get_token(params, deep_symbolize(options.auth_token_params))
68
74
  end
69
75
 
70
76
  end
71
77
  end
72
- end
78
+ end
metadata CHANGED
@@ -1,63 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-wechat-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Skinnyworm
7
+ - Alex Hu
8
8
  - Never Min
9
+ - Eric Guo
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2019-03-15 00:00:00.000000000 Z
13
+ date: 2019-05-02 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: omniauth
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
- - - ~>
19
+ - - ">="
19
20
  - !ruby/object:Gem::Version
20
21
  version: 1.3.2
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - ~>
26
+ - - ">="
26
27
  - !ruby/object:Gem::Version
27
28
  version: 1.3.2
28
29
  - !ruby/object:Gem::Dependency
29
30
  name: omniauth-oauth2
30
31
  requirement: !ruby/object:Gem::Requirement
31
32
  requirements:
32
- - - ~>
33
+ - - ">="
33
34
  - !ruby/object:Gem::Version
34
35
  version: 1.1.1
35
36
  type: :runtime
36
37
  prerelease: false
37
38
  version_requirements: !ruby/object:Gem::Requirement
38
39
  requirements:
39
- - - ~>
40
+ - - ">="
40
41
  - !ruby/object:Gem::Version
41
42
  version: 1.1.1
42
43
  - !ruby/object:Gem::Dependency
43
44
  name: rspec
44
45
  requirement: !ruby/object:Gem::Requirement
45
46
  requirements:
46
- - - ~>
47
+ - - "~>"
47
48
  - !ruby/object:Gem::Version
48
- version: '2.7'
49
+ version: '2.99'
49
50
  type: :development
50
51
  prerelease: false
51
52
  version_requirements: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - ~>
54
+ - - "~>"
54
55
  - !ruby/object:Gem::Version
55
- version: '2.7'
56
+ version: '2.99'
56
57
  description: Using OAuth2 to authenticate wechat user when web resources being viewed
57
58
  within wechat(weixin) client.
58
59
  email:
59
60
  - askinnyworm@gmail.com
60
61
  - Never.Min@gmail.com
62
+ - eric@cloud-mes.com
61
63
  executables: []
62
64
  extensions: []
63
65
  extra_rdoc_files: []
@@ -76,18 +78,17 @@ require_paths:
76
78
  - lib
77
79
  required_ruby_version: !ruby/object:Gem::Requirement
78
80
  requirements:
79
- - - '>='
81
+ - - ">="
80
82
  - !ruby/object:Gem::Version
81
83
  version: 2.0.0
82
84
  required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  requirements:
84
- - - '>='
86
+ - - ">="
85
87
  - !ruby/object:Gem::Version
86
88
  version: '0'
87
89
  requirements:
88
90
  - none
89
- rubyforge_project:
90
- rubygems_version: 2.7.9
91
+ rubygems_version: 3.0.3
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: Omniauth strategy for wechat(weixin)