omniauth-github 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -1
- data/lib/omniauth/strategies/github.rb +11 -1
- data/lib/omniauth-github/version.rb +1 -1
- data/omniauth-github.gemspec +1 -1
- data/spec/omniauth/strategies/github_spec.rb +16 -2
- metadata +47 -19
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This is the official OmniAuth strategy for authenticating to GitHub. To
|
4
4
|
use it, you'll need to sign up for an OAuth2 Application ID and Secret
|
5
|
-
on the [GitHub Applications Page](https://github.com/
|
5
|
+
on the [GitHub Applications Page](https://github.com/settings/applications).
|
6
6
|
|
7
7
|
## Basic Usage
|
8
8
|
|
@@ -10,6 +10,16 @@ on the [GitHub Applications Page](https://github.com/account/applications).
|
|
10
10
|
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
|
11
11
|
end
|
12
12
|
|
13
|
+
### Scopes
|
14
|
+
|
15
|
+
GitHub API v3 lets you set scopes to provide granular access to different types of data:
|
16
|
+
|
17
|
+
use OmniAuth::Builder do
|
18
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: "user,repo,gist"
|
19
|
+
end
|
20
|
+
|
21
|
+
More info on [Scopes](http://developer.github.com/v3/oauth/#scopes).
|
22
|
+
|
13
23
|
## License
|
14
24
|
|
15
25
|
Copyright (c) 2011 Michael Bleigh and Intridea, Inc.
|
@@ -18,8 +18,9 @@ module OmniAuth
|
|
18
18
|
info do
|
19
19
|
{
|
20
20
|
'nickname' => raw_info['login'],
|
21
|
-
'email' =>
|
21
|
+
'email' => email,
|
22
22
|
'name' => raw_info['name'],
|
23
|
+
'image' => raw_info['avatar_url'],
|
23
24
|
'urls' => {
|
24
25
|
'GitHub' => "https://github.com/#{raw_info['login']}",
|
25
26
|
'Blog' => raw_info['blog'],
|
@@ -35,6 +36,15 @@ module OmniAuth
|
|
35
36
|
access_token.options[:mode] = :query
|
36
37
|
@raw_info ||= access_token.get('/user').parsed
|
37
38
|
end
|
39
|
+
|
40
|
+
def email
|
41
|
+
raw_info['email'] || emails.first
|
42
|
+
end
|
43
|
+
|
44
|
+
def emails
|
45
|
+
access_token.options[:mode] = :query
|
46
|
+
@emails ||= access_token.get('/user/emails').parsed
|
47
|
+
end
|
38
48
|
end
|
39
49
|
end
|
40
50
|
end
|
data/omniauth-github.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = OmniAuth::GitHub::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
-
gem.add_dependency 'omniauth-oauth2', '~> 1.
|
19
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1'
|
20
20
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
21
|
gem.add_development_dependency 'rack-test'
|
22
22
|
gem.add_development_dependency 'simplecov'
|
@@ -1,7 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe OmniAuth::Strategies::GitHub do
|
4
|
-
|
5
|
-
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::GitHub.new({})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "client options" do
|
9
|
+
it 'should have correct site' do
|
10
|
+
subject.options.client_options.site.should eq("https://api.github.com")
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should have correct authorize url' do
|
14
|
+
subject.options.client_options.authorize_url.should eq('https://github.com/login/oauth/authorize')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have correct token url' do
|
18
|
+
subject.options.client_options.token_url.should eq('https://github.com/login/oauth/access_token')
|
19
|
+
end
|
6
20
|
end
|
7
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
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:
|
12
|
+
date: 2012-07-06 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,21 +21,31 @@ 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
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: '1.
|
37
|
+
version: '1.1'
|
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.1'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rspec
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '2.7'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.7'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rack-test
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: simplecov
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: webmock
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
description: Official OmniAuth strategy for GitHub.
|
81
111
|
email:
|
82
112
|
- michael@intridea.com
|
@@ -116,10 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
146
|
version: '0'
|
117
147
|
requirements: []
|
118
148
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.8.
|
149
|
+
rubygems_version: 1.8.24
|
120
150
|
signing_key:
|
121
151
|
specification_version: 3
|
122
152
|
summary: Official OmniAuth strategy for GitHub.
|
123
|
-
test_files:
|
124
|
-
- spec/omniauth/strategies/github_spec.rb
|
125
|
-
- spec/spec_helper.rb
|
153
|
+
test_files: []
|