omniauth-douban-oauth2 0.0.6 → 0.0.7
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.
- checksums.yaml +7 -0
- data/README.md +13 -9
- data/lib/omniauth-douban/version.rb +1 -1
- data/lib/omniauth/strategies/douban.rb +8 -0
- data/omniauth-douban-oauth2.gemspec +2 -1
- metadata +9 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 09cd392a18ba84e2cb0732a7321a595e46384c8f
|
4
|
+
data.tar.gz: 82886fbf8d8069d158468677aed7aae0df97f49a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3909153f0ac24a639b88b4223e5d6c07e3e84a753b6efdbd83385a52cf9bc728eacbb889fe27dcf7e2c91258295aab83364bb2587a6f5650270a5ff76a065c3
|
7
|
+
data.tar.gz: c9ad5760cdaa39cf4845f7089189bcbc23f501edabe7de02ddd771c2824ddaaf24298aae5e504c2449e34dc7cac47682704b9320f3304de9e18c3f635a160488
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# OmniAuth-Douban-OAuth2
|
2
|
-
|
2
|
+
|
3
3
|
This is the OmniAuth strategy for authenticating to Douban. To use it, you'll need to sign up for an OAuth2 Application Key and Secret on the [Open Platform](https://www.douban.com/service/auth2/apikey/apply)
|
4
4
|
|
5
5
|
|
@@ -17,7 +17,13 @@ use OmniAuth::Builder do
|
|
17
17
|
end
|
18
18
|
```
|
19
19
|
|
20
|
-
##
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
#### Rails
|
23
|
+
[Rails + Devise + Omniauth-douban-oauth2](https://github.com/vvvvae/omniauth-douban-oauth2-demo#)
|
24
|
+
|
25
|
+
|
26
|
+
#### Sinatra
|
21
27
|
|
22
28
|
``` ruby
|
23
29
|
require 'sinatra'
|
@@ -56,14 +62,12 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
56
62
|
"provider" => "douban",
|
57
63
|
"uid" => "2217855",
|
58
64
|
"info" => {
|
59
|
-
"uid" => "xiaosong",
|
60
65
|
"name" => "小松其实还没有",
|
61
|
-
|
62
|
-
"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
"created" => "2008-02-05 15:26:44"
|
66
|
+
"nickname" => "xiaosong",
|
67
|
+
"location" => "陕西西安",
|
68
|
+
"image" => "http://img3.douban.com/icon/u2217855-34.jpg",
|
69
|
+
"urls" => { :alt => "http://www.douban.com/people/xiaosong/" },
|
70
|
+
"description" => "你确实知道就必须证明",
|
67
71
|
},
|
68
72
|
"credentials" => {
|
69
73
|
"token" => "6516f0d........", # OAuth 2.0 access_token
|
@@ -3,6 +3,8 @@ require 'omniauth-oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Douban < OmniAuth::Strategies::OAuth2
|
6
|
+
DEFAULT_SCOPE = 'douban_basic_common,shuo_basic_r,shuo_basic_w'
|
7
|
+
|
6
8
|
option :name, 'douban'
|
7
9
|
|
8
10
|
option :client_options, {
|
@@ -41,6 +43,12 @@ module OmniAuth
|
|
41
43
|
raise e
|
42
44
|
end
|
43
45
|
|
46
|
+
def authorize_params
|
47
|
+
super.tap do |params|
|
48
|
+
params[:scope] = request.params['scope'] || params[:scope] || DEFAULT_SCOPE
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -5,9 +5,10 @@ require File.expand_path('../lib/omniauth-douban/version', __FILE__)
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.authors = ['Liluo']
|
7
7
|
gem.email = ['i@liluo.org']
|
8
|
-
gem.description = %q{OmniAuth OAuth2 strategy for Douban.}
|
9
8
|
gem.summary = %q{OmniAuth OAuth2 strategy for Douban.}
|
9
|
+
gem.description = %q{OmniAuth OAuth2 strategy for Douban.}
|
10
10
|
gem.homepage = 'https://github.com/liluo/omniauth-douban-oauth2'
|
11
|
+
gem.license = 'MIT'
|
11
12
|
|
12
13
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
14
|
gem.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-douban-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Liluo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: omniauth
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: omniauth-oauth2
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -58,27 +53,27 @@ files:
|
|
58
53
|
- lib/omniauth/strategies/douban.rb
|
59
54
|
- omniauth-douban-oauth2.gemspec
|
60
55
|
homepage: https://github.com/liluo/omniauth-douban-oauth2
|
61
|
-
licenses:
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
62
59
|
post_install_message:
|
63
60
|
rdoc_options: []
|
64
61
|
require_paths:
|
65
62
|
- lib
|
66
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
64
|
requirements:
|
69
|
-
- -
|
65
|
+
- - '>='
|
70
66
|
- !ruby/object:Gem::Version
|
71
67
|
version: '0'
|
72
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
69
|
requirements:
|
75
|
-
- -
|
70
|
+
- - '>='
|
76
71
|
- !ruby/object:Gem::Version
|
77
72
|
version: '0'
|
78
73
|
requirements: []
|
79
74
|
rubyforge_project:
|
80
|
-
rubygems_version:
|
75
|
+
rubygems_version: 2.0.0
|
81
76
|
signing_key:
|
82
|
-
specification_version:
|
77
|
+
specification_version: 4
|
83
78
|
summary: OmniAuth OAuth2 strategy for Douban.
|
84
79
|
test_files: []
|