Skip to content

Commit

Permalink
Fix Doorkeeper::AccessToken.find_or_create_for with empty scopes
Browse files Browse the repository at this point in the history
Fixes #1699
  • Loading branch information
nbulaj committed Jul 10, 2024
1 parent 1cd750b commit 3af9ca0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ User-visible changes worth mentioning.

Add your entry here.

- [#1714] Fix `Doorkeeper::AccessToken.find_or_create_for` with empty scopes which raises NoMethodError

## 5.7.1

- [#1705] Add `force_pkce` option that requires non-confidential clients to use PKCE when requesting an access_token using an authorization code
Expand Down
2 changes: 2 additions & 0 deletions lib/doorkeeper/models/access_token_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def custom_attributes_match?(token, custom_attributes)
# @return [Doorkeeper::AccessToken] existing record or a new one
#
def find_or_create_for(application:, resource_owner:, scopes:, **token_attributes)
scopes = Doorkeeper::OAuth::Scopes.from_string(scopes) if scopes.is_a?(String)

if Doorkeeper.config.reuse_access_token
custom_attributes = extract_custom_attributes(token_attributes).presence
access_token = matching_token_for(
Expand Down

0 comments on commit 3af9ca0

Please sign in to comment.