module Doorkeeper::AccessTokenMixin::ClassMethods
def find_matching_token(relation, application, custom_attributes, scopes)
-
(Doorkeeper::AccessToken, nil)- Access Token instance or
Parameters:
-
custom_attributes(Nilable Hash) -- -
scopes(String, Doorkeeper::OAuth::Scopes) -- -
application(Doorkeeper::Application) -- -
relation(ActiveRecord::Relation) --
def find_matching_token(relation, application, custom_attributes, scopes) return nil unless relation matching_tokens = [] batch_size = Doorkeeper.configuration.token_lookup_batch_size find_access_token_in_batches(relation, batch_size: batch_size) do |batch| tokens = batch.select do |token| scopes_match?(token.scopes, scopes, application&.scopes) && custom_attributes_match?(token, custom_attributes) end matching_tokens.concat(tokens) end matching_tokens.max_by(&:created_at) end