omniauth-tqq-oauth2 0.0.3 → 0.0.4
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.
- data/lib/omniauth-tqq-oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/tqq2.rb +10 -24
- metadata +6 -6
@@ -23,13 +23,17 @@ module OmniAuth
|
|
23
23
|
# or as a URI parameter). This may not be possible with all
|
24
24
|
# providers.
|
25
25
|
uid {
|
26
|
-
|
26
|
+
raw_info["name"]
|
27
27
|
}
|
28
28
|
|
29
29
|
info do
|
30
30
|
{
|
31
|
-
:name
|
32
|
-
:
|
31
|
+
:name => raw_info['name'],
|
32
|
+
:nickname => raw_info['nick'],
|
33
|
+
:email => raw_info['email'],
|
34
|
+
:location => raw_info['location'],
|
35
|
+
:image => raw_info['head'],
|
36
|
+
:description => raw_info['introduction']
|
33
37
|
}
|
34
38
|
end
|
35
39
|
|
@@ -49,30 +53,12 @@ module OmniAuth
|
|
49
53
|
hash
|
50
54
|
end
|
51
55
|
|
52
|
-
def build_access_token
|
53
|
-
verifier = request.params['code']
|
54
|
-
@ac_token ||= client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true)))
|
55
|
-
end
|
56
|
-
|
57
56
|
def callback_phase
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
self.access_token = build_access_token
|
63
|
-
self.access_token = access_token.refresh! if access_token.expired?
|
57
|
+
# 伪造防csrf的state,腾讯微博NMMP
|
58
|
+
request.params['state'] = session['omniauth.state']
|
64
59
|
@openid = request.params["openid"]
|
65
60
|
@openkey = request.params["openkey"]
|
66
|
-
|
67
61
|
super
|
68
|
-
rescue ::OAuth2::Error, CallbackError => e
|
69
|
-
fail!(:invalid_credentials, e)
|
70
|
-
rescue ::MultiJson::DecodeError => e
|
71
|
-
fail!(:invalid_response, e)
|
72
|
-
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
|
73
|
-
fail!(:timeout, e)
|
74
|
-
rescue ::SocketError => e
|
75
|
-
fail!(:failed_to_connect, e)
|
76
62
|
end
|
77
63
|
|
78
64
|
def raw_info
|
@@ -81,7 +67,7 @@ module OmniAuth
|
|
81
67
|
oauth_consumer_key: access_token.client.id,
|
82
68
|
access_token: access_token.token,
|
83
69
|
oauth_version: '2.a'
|
84
|
-
}, parse: :json).parsed
|
70
|
+
}, parse: :json).parsed["data"]
|
85
71
|
end
|
86
72
|
end
|
87
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-tqq-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &70240404745360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70240404745360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: omniauth-oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &70240404761100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70240404761100
|
36
36
|
description: OmniAuth Oauth2 strategy for t.qq.com.
|
37
37
|
email:
|
38
38
|
- cqpanxu@gmail.com
|