mirror of
https://github.com/simi/omniauth-facebook.git
synced 2022-11-09 12:32:45 -05:00
include default scope to more closely emulate omniauth 0.3.0 behaviour
This commit is contained in:
parent
65a3e5f8ef
commit
5f5109585d
2 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,8 @@ require 'omniauth/strategies/oauth2'
|
|||
module OmniAuth
|
||||
module Strategies
|
||||
class Facebook < OmniAuth::Strategies::OAuth2
|
||||
DEFAULT_SCOPE = 'email,offline_access'
|
||||
|
||||
option :client_options, {
|
||||
:site => 'https://graph.facebook.com',
|
||||
:token_url => '/oauth/access_token'
|
||||
|
@ -66,6 +68,7 @@ module OmniAuth
|
|||
def authorize_params
|
||||
super.tap do |params|
|
||||
params.merge!(:display => request.params['display']) if request.params['display']
|
||||
params[:scope] ||= DEFAULT_SCOPE
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -30,8 +30,9 @@ describe OmniAuth::Strategies::Facebook do
|
|||
end
|
||||
|
||||
describe '#authorize_params' do
|
||||
it 'is empty by default' do
|
||||
subject.authorize_params.should be_empty
|
||||
it 'includes default scope for email and offline access' do
|
||||
subject.authorize_params.should be_a(Hash)
|
||||
subject.authorize_params[:scope].should eq('email,offline_access')
|
||||
end
|
||||
|
||||
it 'includes display parameter from request when present' do
|
||||
|
|
Loading…
Reference in a new issue