Codebase list ruby-omniauth-facebook / 18b3991
Import upstream version 5.0.0, md5 6eec4149692eaa4f4ec0329cf726584a Debian Janitor 4 years ago
8 changed file(s) with 32 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
33 - gem update --system
44 - gem --version
55 rvm:
6 - 2.3.0
6 - 2.5
7 - 2.4
8 - 2.3
79 - 2.2
810 - 2.1
911 - 2.0
10 - 1.9.3
11 - jruby-19mode
12 - rbx-2
0 ## 5.0.0 (2018-03-29)
1
2 Changes:
3
4 - bumped version of FB Graph API to v2.10 (#297, @piotrjaworski)
5 - use only CRuby 2.0+ on CI (#298, @simi)
6
07 ## 4.0.0 (2016-07-26)
18
29 Changes:
512 - switch to versioned FB APIs, currently using v2.6 (#245, @printercu, @mkdynamic)
613 - remove deprecated :nickname field from README example (#223, @abelorian)
714 - add Ruby 2.2 + 2.3.0 to CI (#225, @tricknotes, @mkdynamic, @anoraak)
8 - update example app (@mkynamic)
15 - update example app (@mkdynamic)
916
1017 ## 3.0.0 (2015-10-26)
1118
11
22 gemspec
33
4 gem 'rack', RUBY_VERSION < '2.2.2' ? '~> 1.6' : '>= 2.0'
5
46 platforms :rbx do
57 gem 'rubysl', '~> 2.0'
68 end
00 # OmniAuth Facebook &nbsp;[![Build Status](https://secure.travis-ci.org/mkdynamic/omniauth-facebook.svg?branch=master)](https://travis-ci.org/mkdynamic/omniauth-facebook) [![Gem Version](https://img.shields.io/gem/v/omniauth-facebook.svg)](https://rubygems.org/gems/omniauth-facebook)
1
2 📣 **NOTICE** We’re looking for maintainers to help keep this project up-to-date. If you are interested in helping please open an Issue expressing your interest. Thanks! 📣
13
24 **These notes are based on master, please see tags for README pertaining to specific releases.**
35
5557
5658 ### API Version
5759
58 OmniAuth Facebook uses versioned API endpoints by default (current v2.6). You can configure a different version via `client_options` hash passed to `provider`, specifically you should change the version in the `site` and `authorize_url` parameters. For example, to change to v3.0 (assuming that exists):
60 OmniAuth Facebook uses versioned API endpoints by default (current v2.10). You can configure a different version via `client_options` hash passed to `provider`, specifically you should change the version in the `site` and `authorize_url` parameters. For example, to change to v3.0 (assuming that exists):
5961
6062 ```ruby
6163 use OmniAuth::Builder do
8587 first_name: 'Joe',
8688 last_name: 'Bloggs',
8789 image: 'http://graph.facebook.com/1234567/picture?type=square',
88 urls: { Facebook: 'http://www.facebook.com/jbloggs' },
89 location: 'Palo Alto, California',
9090 verified: true
9191 },
9292 credentials: {
151151
152152 ## Supported Rubies
153153
154 - Ruby MRI (1.9.3+)
155 - JRuby (1.9 mode)
156 - RBX (2.1.1+)
154 - Ruby MRI (2.0+)
157155
158156 ## License
159157
2727 window.fbAsyncInit = function() {
2828 FB.init({
2929 appId: '#{ENV['APP_ID']}',
30 version: 'v2.6',
30 version: 'v2.10',
3131 cookie: true // IMPORTANT must enable cookies to allow the server to access the session
3232 });
3333 console.log("fb init");
00 module OmniAuth
11 module Facebook
2 VERSION = "4.0.0"
2 VERSION = '5.0.0'
33 end
44 end
1111 DEFAULT_SCOPE = 'email'
1212
1313 option :client_options, {
14 site: 'https://graph.facebook.com/v2.6',
15 authorize_url: "https://www.facebook.com/v2.6/dialog/oauth",
14 site: 'https://graph.facebook.com/v2.10',
15 authorize_url: "https://www.facebook.com/v2.10/dialog/oauth",
1616 token_url: 'oauth/access_token'
1717 }
1818
88
99 class ClientTest < StrategyTestCase
1010 test 'has correct Facebook site' do
11 assert_equal 'https://graph.facebook.com/v2.6', strategy.client.site
11 assert_equal 'https://graph.facebook.com/v2.10', strategy.client.site
1212 end
1313
1414 test 'has correct authorize url' do
15 assert_equal 'https://www.facebook.com/v2.6/dialog/oauth', strategy.client.options[:authorize_url]
15 assert_equal 'https://www.facebook.com/v2.10/dialog/oauth', strategy.client.options[:authorize_url]
1616 end
1717
1818 test 'has correct token url with versioning' do
9898 @options = { secure_image_url: true }
9999 raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
100100 strategy.stubs(:raw_info).returns(raw_info)
101 assert_equal 'https://graph.facebook.com/v2.6/321/picture', strategy.info['image']
101 assert_equal 'https://graph.facebook.com/v2.10/321/picture', strategy.info['image']
102102 end
103103
104104 test 'returns the image_url based of the client site' do
112112 @options = { image_size: 'normal' }
113113 raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
114114 strategy.stubs(:raw_info).returns(raw_info)
115 assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
115 assert_equal 'http://graph.facebook.com/v2.10/321/picture?type=normal', strategy.info['image']
116116 end
117117
118118 test 'returns the image with size specified as a symbol in the `image_size` option' do
119119 @options = { image_size: :normal }
120120 raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
121121 strategy.stubs(:raw_info).returns(raw_info)
122 assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
122 assert_equal 'http://graph.facebook.com/v2.10/321/picture?type=normal', strategy.info['image']
123123 end
124124
125125 test 'returns the image with width and height specified in the `image_size` option' do
128128 strategy.stubs(:raw_info).returns(raw_info)
129129 assert_match 'width=123', strategy.info['image']
130130 assert_match 'height=987', strategy.info['image']
131 assert_match 'http://graph.facebook.com/v2.6/321/picture?', strategy.info['image']
131 assert_match 'http://graph.facebook.com/v2.10/321/picture?', strategy.info['image']
132132 end
133133 end
134134
175175
176176 test 'returns the facebook avatar url' do
177177 @raw_info['id'] = '321'
178 assert_equal 'http://graph.facebook.com/v2.6/321/picture', strategy.info['image']
178 assert_equal 'http://graph.facebook.com/v2.10/321/picture', strategy.info['image']
179179 end
180180
181181 test 'returns the Facebook link as the Facebook url' do
257257 @options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
258258 end
259259
260 test 'performs a GET to https://graph.facebook.com/v2.6/me' do
260 test 'performs a GET to https://graph.facebook.com/v2.10/me' do
261261 strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
262262 strategy.stubs(:access_token).returns(@access_token)
263263 params = {params: @options}
265265 strategy.raw_info
266266 end
267267
268 test 'performs a GET to https://graph.facebook.com/v2.6/me with locale' do
268 test 'performs a GET to https://graph.facebook.com/v2.10/me with locale' do
269269 @options.merge!({ locale: 'cs_CZ' })
270270 strategy.stubs(:access_token).returns(@access_token)
271271 strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
274274 strategy.raw_info
275275 end
276276
277 test 'performs a GET to https://graph.facebook.com/v2.6/me with info_fields' do
277 test 'performs a GET to https://graph.facebook.com/v2.10/me with info_fields' do
278278 @options.merge!({info_fields: 'about'})
279279 strategy.stubs(:access_token).returns(@access_token)
280280 strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
283283 strategy.raw_info
284284 end
285285
286 test 'performs a GET to https://graph.facebook.com/v2.6/me with default info_fields' do
286 test 'performs a GET to https://graph.facebook.com/v2.10/me with default info_fields' do
287287 strategy.stubs(:access_token).returns(@access_token)
288288 strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
289289 params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}