Skip to content

Commit

Permalink
v0.5.0: Add prompt option that allows forcing relogin
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed Apr 4, 2019
1 parent f802457 commit e3ccbb3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.5.0] - 2019-04-04

### Added

- Added `prompt` option to allow login under different credentials. @Envek

See [Getting user consent](https://developer.ebay.com/api-docs/static/oauth-consent-request.html) documentation page for details.

## [0.4.0] - 2018-08-10

### Changed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Required options:
Additional options:
- __sandbox__ - Are you running your application in [sandbox mode](<https://developer.ebay.com/api-docs/static/sandbox-landing.html>), default __`true`__.
- __scope__ - A list of [OAuth scopes](<https://developer.ebay.com/api-docs/static/oauth-details.html#scopes>) that provide access to the interfaces you call, default: __`[]`__. If you want change scopes you could pass it as string or as array of scopes like so: `['https://api.ebay.com/oauth/api_scope/sell.marketing.readonly', 'https://api.ebay.com/oauth/api_scope/sell.account.readonly']`
- __prompt__ - Use value `login` to ask user for login and password even if they're already logged in (useful for switching between multiple accounts). By default is absent.
- __read_timeout__ - Number of seconds to wait for one block to be read for Auth'n'auth eBay API requests, default is 60.
- \+ all [OmniAuth](<https://github.com/omniauth/omniauth>) supported options, like: `callback_path`, `provider_ignores_state` and so on.

Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/ebay-oauth/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module OmniAuth
module EbayOauth
VERSION = '0.4.0'
VERSION = '0.5.0'
end
end
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/ebay_oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EbayOauth < OmniAuth::Strategies::OAuth2
option :sandbox, true
option :callback_url

option :authorize_options, %i[scope]
option :authorize_options, %i[scope prompt]
option :client_options, auth_scheme: :basic_auth, read_timeout: 60

uid { user_info.uid }
Expand Down
14 changes: 14 additions & 0 deletions spec/omniauth/strategies/ebay_oauth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@
end
end

context "when prompt isn't provided" do
it 'is absent' do
expect(subject.options.prompt).to be_nil
end
end

context 'when prompt is provided' do
let(:options) { { prompt: :login } }

it 'concatenates passed scopes with space' do
expect(subject.options.prompt).to eql :login
end
end

context 'sandbox mode' do
let(:options) { { sandbox: true } }

Expand Down

0 comments on commit e3ccbb3

Please sign in to comment.