From 185c9f587a49c8b83079b724302e317e54abba04 Mon Sep 17 00:00:00 2001 From: David Verhasselt Date: Thu, 30 Nov 2017 08:54:56 +0200 Subject: [PATCH] Make native redirect code a query param This allows for automated flows to detect that an Authorization code was granted in much the same way as a normal redirect. This is used by e.g. Mac Paw. --- lib/doorkeeper/rails/routes.rb | 2 +- spec/controllers/authorizations_controller_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/doorkeeper/rails/routes.rb b/lib/doorkeeper/rails/routes.rb index 00873f99c..a90ff8741 100644 --- a/lib/doorkeeper/rails/routes.rb +++ b/lib/doorkeeper/rails/routes.rb @@ -49,7 +49,7 @@ def authorization_routes(mapping) as: mapping[:as], controller: mapping[:controllers] ) do - routes.get '/:code', action: :show, on: :member + routes.get '/native', action: :show, on: :member routes.get '/', action: :new, on: :member end end diff --git a/spec/controllers/authorizations_controller_spec.rb b/spec/controllers/authorizations_controller_spec.rb index c6225bec4..28599b8e2 100644 --- a/spec/controllers/authorizations_controller_spec.rb +++ b/spec/controllers/authorizations_controller_spec.rb @@ -154,7 +154,7 @@ def translated_error_message(key) it 'should redirect immediately' do expect(response).to be_redirect - expect(response.location).to match(/oauth\/authorize\//) + expect(response.location).to match(/oauth\/authorize\/native\?code=/) end it 'should issue a grant' do