Skip to content

Commit

Permalink
add scope option to request more permissions from user
Browse files Browse the repository at this point in the history
  • Loading branch information
kaichen committed Oct 11, 2012
1 parent f9a6240 commit 9520858
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion README.md
Expand Up @@ -24,7 +24,26 @@ Or install it yourself as:
provider :qq_connect, ENV['QQ_CONNECT_APP_KEY'], ENV['QQ_CONNECT_APP_SECRET']
end

*Notice* you only allow send the auth request from host(w/o port) list of application.
*Notice* you only allow send the auth request from host(w/o port) list of
application.

## Configuring

You can configure several options(currently only one), which you pass in to
the provider method via a Hash:

scope: A comma-separated list of permissions you want to request from the
user. See the official docs for a full list of available permissions:
<http://wiki.opensns.qq.com/wiki/%E3%80%90QQ%E7%99%BB%E5%BD%95%E3%80%91API%E6%96%87%E6%A1%A3>
Default: `get_user_info`(获取用户在QQ空间的个人资料)

Example:

use OmniAuth::Builder do
provider :qq_connect,
ENV['QQ_CONNECT_API_KEY'], ENV['QQ_CONNECT_API_SECRET'],
scope: "get_user_info,add_share"
end

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth-qq-connect/version.rb
@@ -1,7 +1,7 @@
module Omniauth
module Qq
module Connect
VERSION = "0.1.0"
VERSION = "0.2.0"
end
end
end
4 changes: 3 additions & 1 deletion lib/omniauth/strategies/qq_connect.rb
Expand Up @@ -18,6 +18,8 @@ class QQConnect < OmniAuth::Strategies::OAuth2
:parse => :query
}

option :authorize_options, [:scope]

uid do
@uid ||= begin
access_token.options[:mode] = :query
Expand Down Expand Up @@ -60,4 +62,4 @@ def raw_info
end
end

OmniAuth.config.add_camelization('qq_connect', 'QQConnect')
OmniAuth.config.add_camelization('qq_connect', 'QQConnect')

0 comments on commit 9520858

Please sign in to comment.