omniauth-google-oauth2 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
data/examples/config.ru
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Sample app for Google OAuth2 Strateg
|
2
|
+
# Run with "bundle exec rackup"
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
require 'sinatra'
|
7
|
+
require 'omniauth'
|
8
|
+
require 'omniauth-google-oauth2'
|
9
|
+
|
10
|
+
class App < Sinatra::Base
|
11
|
+
get '/' do
|
12
|
+
<<-HTML
|
13
|
+
<ul>
|
14
|
+
<li><a href='/auth/google_oauth2'>Sign in with Google</a></li>
|
15
|
+
</ul>
|
16
|
+
HTML
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/auth/:provider/callback' do
|
20
|
+
content_type 'application/json'
|
21
|
+
MultiJson.encode(request.env)
|
22
|
+
end
|
23
|
+
|
24
|
+
get '/auth/failure' do
|
25
|
+
content_type 'application/json'
|
26
|
+
MultiJson.encode(request.env)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
use Rack::Session::Cookie
|
31
|
+
|
32
|
+
use OmniAuth::Builder do
|
33
|
+
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {
|
34
|
+
:scope => 'https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.stream.read https://www.googleapis.com/auth/plus.stream.write https://www.googleapis.com/auth/plus.circles.read https://www.googleapis.com/auth/plus.circles.write'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
run App.new
|
@@ -5,8 +5,8 @@ module OmniAuth
|
|
5
5
|
class GoogleOauth2 < OmniAuth::Strategies::OAuth2
|
6
6
|
option :client_options, {
|
7
7
|
:site => 'https://accounts.google.com',
|
8
|
-
:
|
9
|
-
:
|
8
|
+
:authorize_path => '/o/oauth2/auth',
|
9
|
+
:token_path => '/o/oauth2/token'
|
10
10
|
}
|
11
11
|
|
12
12
|
def request_phase
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-google-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Ellithorpe
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- Gemfile
|
63
63
|
- README.md
|
64
64
|
- Rakefile
|
65
|
+
- examples/config.ru
|
65
66
|
- lib/omniauth-google-oauth2.rb
|
66
67
|
- lib/omniauth/google_oauth2.rb
|
67
68
|
- lib/omniauth/google_oauth2/version.rb
|