omniauth-qq-connect 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -1
- data/lib/omniauth-qq-connect/version.rb +1 -1
- data/lib/omniauth/strategies/qq_connect.rb +20 -10
- metadata +18 -7
data/README.md
CHANGED
@@ -24,7 +24,26 @@ Or install it yourself as:
|
|
24
24
|
provider :qq_connect, ENV['QQ_CONNECT_APP_KEY'], ENV['QQ_CONNECT_APP_SECRET']
|
25
25
|
end
|
26
26
|
|
27
|
-
*Notice* you only allow send the auth request from host(w/o port) list of
|
27
|
+
*Notice* you only allow send the auth request from host(w/o port) list of
|
28
|
+
application.
|
29
|
+
|
30
|
+
## Configuring
|
31
|
+
|
32
|
+
You can configure several options(currently only one), which you pass in to
|
33
|
+
the provider method via a Hash:
|
34
|
+
|
35
|
+
scope: A comma-separated list of permissions you want to request from the
|
36
|
+
user. See the official docs for a full list of available permissions:
|
37
|
+
<http://wiki.opensns.qq.com/wiki/%E3%80%90QQ%E7%99%BB%E5%BD%95%E3%80%91API%E6%96%87%E6%A1%A3>
|
38
|
+
Default: `get_user_info`(获取用户在QQ空间的个人资料)
|
39
|
+
|
40
|
+
Example:
|
41
|
+
|
42
|
+
use OmniAuth::Builder do
|
43
|
+
provider :qq_connect,
|
44
|
+
ENV['QQ_CONNECT_API_KEY'], ENV['QQ_CONNECT_API_SECRET'],
|
45
|
+
scope: "get_user_info,add_share"
|
46
|
+
end
|
28
47
|
|
29
48
|
## Contributing
|
30
49
|
|
@@ -18,14 +18,10 @@ module OmniAuth
|
|
18
18
|
:parse => :query
|
19
19
|
}
|
20
20
|
|
21
|
-
|
22
|
-
raw_info
|
23
|
-
end
|
24
|
-
|
25
|
-
info { user_info }
|
21
|
+
option :authorize_options, [:scope]
|
26
22
|
|
27
|
-
|
28
|
-
@
|
23
|
+
uid do
|
24
|
+
@uid ||= begin
|
29
25
|
access_token.options[:mode] = :query
|
30
26
|
access_token.options[:param_name] = :access_token
|
31
27
|
# Response Example: "callback( {\"client_id\":\"11111\",\"openid\":\"000000FFFF\"} );\n"
|
@@ -36,8 +32,22 @@ module OmniAuth
|
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
info do
|
36
|
+
{
|
37
|
+
:nickname => raw_info['nickname'],
|
38
|
+
:name => raw_info['nickname'], # Since it is required, fill it with nickname
|
39
|
+
:image => raw_info['figureurl_1'],
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
extra do
|
44
|
+
{
|
45
|
+
:raw_info => raw_info
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def raw_info
|
50
|
+
@raw_info ||= begin
|
41
51
|
#TODO handle error case
|
42
52
|
#TODO make info request url configurable
|
43
53
|
client.request(:get, "https://graph.qq.com/user/get_user_info", :params => {
|
@@ -52,4 +62,4 @@ module OmniAuth
|
|
52
62
|
end
|
53
63
|
end
|
54
64
|
|
55
|
-
OmniAuth.config.add_camelization('qq_connect', 'QQConnect')
|
65
|
+
OmniAuth.config.add_camelization('qq_connect', 'QQConnect')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-qq-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: omniauth-oauth2
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '1.0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.0'
|
36
46
|
description: OmniAuth strategy for QQ Connect.
|
37
47
|
email:
|
38
48
|
- kaichenxyz@gmail.com
|
@@ -69,8 +79,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
79
|
version: '0'
|
70
80
|
requirements: []
|
71
81
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.8.
|
82
|
+
rubygems_version: 1.8.23
|
73
83
|
signing_key:
|
74
84
|
specification_version: 3
|
75
85
|
summary: OmniAuth strategy for QQ Connect.
|
76
86
|
test_files: []
|
87
|
+
has_rdoc:
|