omniauth-wechat-oauth2 0.2.0 → 0.2.1

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: ef485d4684f90ed4a598de6ec279b07a5019a397a55f6e36ec36186a8675cf2b
4
- data.tar.gz: '049a415287f7c4f8c1b7a0cb2b5b80de3d114045927f94c6304dffe13ca601b8'
3
+ metadata.gz: 6887df3d9cb9e1d0af5f77a80ceb353ed99e45c4aded5802b94f8ff06c2b44b7
4
+ data.tar.gz: 45081ea29f1423808a236d5d708ac21b0b76aa86fa6032add3f06de1b1251168
5
5
  SHA512:
6
- metadata.gz: cd1008221478aae3295f6a319d31fd8f69644350d13a1761d5ac19650a6f972710b0265a1f05b971c3ddafd8f3e6e56d2571387ad08b4cdf4a7485ad4ed6ec7e
7
- data.tar.gz: a4583e337826afd7245cb1211befbcd171efc34cde7bade245f87bfe5705e41734d12af844dfc5a81d04906edfba2860146762b4befd50c2f616d71ce8524e33
6
+ metadata.gz: 91ca3a9a3ff98631767e7f54f16206a08ca488fe5a0a24709ad9c8f07e4e3a1483960326a256f7b36acaefae293f01e2cd57a672d9fe3d69205bc3d3be575a51
7
+ data.tar.gz: 7a0d38a8a9e51213e3d7981a45b599cc12b5f35ce8f85da86e04acb9c5b2b8c91084c6971beb1fe87ad834376e03875c94566f8725ad1cadc7583fc680a34a13
data/README.md CHANGED
@@ -14,7 +14,8 @@ Wechat OAuth2 Strategy for OmniAuth 1.0.
14
14
 
15
15
  You need to get a wechat API key at: https://mp.weixin.qq.com
16
16
 
17
- Wechat oauth2 specification can be found at: https://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
17
+ * Wechat oauth2 specification can be found at: https://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
18
+ * Wechat Qiye oauth2 specification can be found at: http://qydev.weixin.qq.com/wiki/index.php?title=OAuth验证接口
18
19
 
19
20
  ## Installation
20
21
 
@@ -90,6 +91,48 @@ Here's an example of an authentication hash available in the callback by accessi
90
91
  }
91
92
  ```
92
93
 
94
+ ## Wechat Qiye OAuth2
93
95
 
96
+ Wechat Qiey usage and configuration are the same with normal account above.
94
97
 
98
+ ```ruby
99
+ config.omniauth :wechat_qiye, ENV["WECHAT_APP_ID"], ENV["WECHAT_APP_SECRET"],
100
+ :authorize_params => {:scope => "snsapi_base"}
101
+ ```
95
102
 
103
+ Auth hash `request.env["omniauth.auth"]`
104
+
105
+ ```ruby
106
+ {
107
+ :provider => "wechat_qiye",
108
+ :uid => "123456789",
109
+ :info => {
110
+ userid: "userid",
111
+ name: "name",
112
+ department: [2],
113
+ gender: "1",
114
+ weixinid: "weixinid",
115
+ avatar: "avatar",
116
+ status: 1,
117
+ extattr: {"foo" => "bar"}
118
+ },
119
+ :credentials => {
120
+ :token => "token",
121
+ :refresh_token => "another_token",
122
+ :expires_at => 7200,
123
+ :expires => true
124
+ },
125
+ :extra => {
126
+ :raw_info => {
127
+ userid: "userid",
128
+ name: "name",
129
+ department: [2],
130
+ gender: "1",
131
+ weixinid: "weixinid",
132
+ avatar: "avatar",
133
+ status: 1,
134
+ extattr: {"foo" => "bar"}}
135
+ }
136
+ }
137
+ }
138
+ ```
@@ -1,2 +1 @@
1
- require "omniauth/strategies/wechat"
2
- require "omniauth/strategies/wechat_qiye"
1
+ require "omniauth/wechat"
@@ -32,6 +32,7 @@ module OmniAuth
32
32
  city: raw_info['city'],
33
33
  country: raw_info['country'],
34
34
  headimgurl: raw_info['headimgurl'],
35
+ image: raw_info['headimgurl'],
35
36
  unionid: raw_info['unionid']
36
37
  }
37
38
  end
@@ -0,0 +1,2 @@
1
+ require "omniauth/strategies/wechat"
2
+ require "omniauth/strategies/wechat_qiye"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-wechat-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Hu
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-06-09 00:00:00.000000000 Z
13
+ date: 2020-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: omniauth
@@ -68,6 +68,7 @@ files:
68
68
  - lib/omniauth-wechat-oauth2.rb
69
69
  - lib/omniauth/strategies/wechat.rb
70
70
  - lib/omniauth/strategies/wechat_qiye.rb
71
+ - lib/omniauth/wechat.rb
71
72
  homepage: https://github.com/nevermin/omniauth-wechat-oauth2
72
73
  licenses:
73
74
  - MIT