Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nbulaj committed Nov 29, 2022
1 parent 1cc879b commit 2a8b318
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions lib/doorkeeper/oauth/base_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def scopes
def find_or_create_access_token(client, resource_owner, scopes, server)
context = Authorization::Token.build_context(client, grant_type, scopes, resource_owner)
@access_token = server_config.access_token_model.find_or_create_for(
application: application,
application: client.is_a?(server_config.application_model) ? client : client&.application,
resource_owner: resource_owner,
scopes: scopes,
expires_in: Authorization::Token.access_token_expires_in(server, context),
Expand All @@ -49,12 +49,6 @@ def server_config
Doorkeeper.config
end

def application
return unless client

client.is_a?(server_config.application_model) ? client : client.application
end

private

def build_scopes
Expand Down
2 changes: 1 addition & 1 deletion lib/doorkeeper/oauth/client_credentials/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call(client, scopes, attributes = {})
end

with_revocation(existing_token: existing_token) do
application = client.is_a?(server_config.application_model) ? client : client.application if client
application = client.is_a?(server_config.application_model) ? client : client&.application
server_config.access_token_model.create_for(
application: application,
resource_owner: nil,
Expand Down

0 comments on commit 2a8b318

Please sign in to comment.