Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#43653] fixed auth state with invalid client tokens

Eric Schubert36f68a733656
diff --git a/app/services/oauth_clients/connection_manager.rb b/app/services/oauth_clients/connection_manager.rb
index 60373dd6b00..aa0422df0d1 100644
--- a/app/services/oauth_clients/connection_manager.rb
+++ b/app/services/oauth_clients/connection_manager.rb
@@ -132,7 +132,7 @@ module OAuthClients
service_result = refresh_token # `refresh_token` already has exception handling
return :connected if service_result.success?
- if service_result.result == 'invalid_grant'
+ if service_result.result == 'invalid_request'
# This can happen if the Authorization Server invalidated all tokens.
# Then the user would ideally be asked to reauthorize.
:failed_authorization
diff --git a/spec/services/oauth_clients/connection_manager_spec.rb b/spec/services/oauth_clients/connection_manager_spec.rb
index 6ae30c63c5e..194536ae4a6 100644
--- a/spec/services/oauth_clients/connection_manager_spec.rb
+++ b/spec/services/oauth_clients/connection_manager_spec.rb
@@ -427,7 +427,7 @@ describe ::OAuthClients::ConnectionManager, type: :model do
end
context 'with invalid refresh token' do
- let(:refresh_service_result) { ServiceResult.failure(result: 'invalid_grant') }
+ let(:refresh_service_result) { ServiceResult.failure(result: 'invalid_request') }
it 'refreshes the access token and returns :failed_authorization' do
expect(subject).to eq :failed_authorization