omniauth_llx 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'sinatra-reloader'
5
+ gem 'omniauth-facebook', :path => '../'
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ omniauth-facebook (2.0.0)
5
+ omniauth-oauth2 (~> 1.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ backports (3.3.5)
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ hashie (3.2.0)
14
+ jwt (1.0.0)
15
+ multi_json (1.8.2)
16
+ multi_xml (0.5.5)
17
+ multipart-post (2.0.0)
18
+ oauth2 (1.0.0)
19
+ faraday (>= 0.8, < 0.10)
20
+ jwt (~> 1.0)
21
+ multi_json (~> 1.3)
22
+ multi_xml (~> 0.5)
23
+ rack (~> 1.2)
24
+ omniauth (1.2.2)
25
+ hashie (>= 1.2, < 4)
26
+ rack (~> 1.0)
27
+ omniauth-oauth2 (1.2.0)
28
+ faraday (>= 0.8, < 0.10)
29
+ multi_json (~> 1.3)
30
+ oauth2 (~> 1.0)
31
+ omniauth (~> 1.2)
32
+ rack (1.5.2)
33
+ rack-protection (1.5.1)
34
+ rack
35
+ rack-test (0.6.2)
36
+ rack (>= 1.0)
37
+ sinatra (1.4.4)
38
+ rack (~> 1.4)
39
+ rack-protection (~> 1.4)
40
+ tilt (~> 1.3, >= 1.3.4)
41
+ sinatra-contrib (1.4.2)
42
+ backports (>= 2.0)
43
+ multi_json
44
+ rack-protection
45
+ rack-test
46
+ sinatra (~> 1.4.0)
47
+ tilt (~> 1.3)
48
+ sinatra-reloader (1.0)
49
+ sinatra-contrib
50
+ tilt (1.4.1)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ omniauth-facebook!
57
+ sinatra
58
+ sinatra-reloader
@@ -0,0 +1,93 @@
1
+ require 'sinatra'
2
+ require "sinatra/reloader"
3
+ require 'yaml'
4
+
5
+ # configure sinatra
6
+ set :run, false
7
+ set :raise_errors, true
8
+
9
+ # setup logging to file
10
+ log = File.new("app.log", "a+")
11
+ $stdout.reopen(log)
12
+ $stderr.reopen(log)
13
+ $stderr.sync = true
14
+ $stdout.sync = true
15
+
16
+ # server-side flow
17
+ get '/server-side' do
18
+ # NOTE: You would just hit this endpoint directly from the browser in a real app. The redirect is just here to
19
+ # explicit declare this server-side flow.
20
+ redirect '/auth/facebook'
21
+ end
22
+
23
+ # client-side flow
24
+ get '/client-side' do
25
+ content_type 'text/html'
26
+ # NOTE: When you enable cookie below in the FB.init call the GET request in the FB.login callback will send a signed
27
+ # request in a cookie back the OmniAuth callback which will parse out the authorization code and obtain an
28
+ # access_token with it.
29
+ <<-END
30
+ <html>
31
+ <head>
32
+ <title>Client-side Flow Example</title>
33
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
34
+ </head>
35
+ <body>
36
+ <div id="fb-root"></div>
37
+
38
+ <script type="text/javascript">
39
+ window.fbAsyncInit = function() {
40
+ FB.init({
41
+ appId : '#{ENV['APP_ID']}',
42
+ status : true, // check login status
43
+ cookie : true, // enable cookies to allow the server to access the session
44
+ xfbml : true // parse XFBML
45
+ });
46
+ };
47
+
48
+ (function(d) {
49
+ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
50
+ js = d.createElement('script'); js.id = id; js.async = true;
51
+ js.src = "//connect.facebook.net/en_US/all.js";
52
+ d.getElementsByTagName('head')[0].appendChild(js);
53
+ }(document));
54
+
55
+ $(function() {
56
+ $('a').click(function(e) {
57
+ e.preventDefault();
58
+
59
+ FB.login(function(response) {
60
+ if (response.authResponse) {
61
+ $('#connect').html('Connected! Hitting OmniAuth callback (GET /auth/facebook/callback)...');
62
+
63
+ // since we have cookies enabled, this request will allow omniauth to parse
64
+ // out the auth code from the signed request in the fbsr_XXX cookie
65
+ $.getJSON('/auth/facebook/callback', function(json) {
66
+ $('#connect').html('Connected! Callback complete.');
67
+ $('#results').html(JSON.stringify(json));
68
+ });
69
+ }
70
+ }, { scope: 'email,read_stream', state: 'abc123' });
71
+ });
72
+ });
73
+ </script>
74
+
75
+ <p id="connect">
76
+ <a href="#">Connect to FB!</a>
77
+ </p>
78
+
79
+ <p id="results" />
80
+ </body>
81
+ </html>
82
+ END
83
+ end
84
+
85
+ get '/auth/:provider/callback' do
86
+ content_type 'application/json'
87
+ MultiJson.encode(request.env)
88
+ end
89
+
90
+ get '/auth/failure' do
91
+ content_type 'application/json'
92
+ MultiJson.encode(request.env)
93
+ end
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ require 'omniauth-facebook'
3
+ require './app.rb'
4
+
5
+ use Rack::Session::Cookie, :secret => 'abc123'
6
+
7
+ use OmniAuth::Builder do
8
+ provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'], :scope => 'email,read_stream'
9
+ end
10
+
11
+ run Sinatra::Application
@@ -1,5 +1,5 @@
1
1
  module OmniauthLlx
2
2
  module Llx
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_llx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -113,6 +113,10 @@ executables: []
113
113
  extensions: []
114
114
  extra_rdoc_files: []
115
115
  files:
116
+ - lib/example/app.rb
117
+ - lib/example/config.ru
118
+ - lib/example/Gemfile
119
+ - lib/example/Gemfile.lock
116
120
  - lib/omniauth_llx/llx/version.rb
117
121
  - lib/omniauth_llx/llx.rb
118
122
  - lib/omniauth_llx/strategies/llx.rb