module Doorkeeper::AccessTokenMixin::ClassMethods

def matching_token_for(application, resource_owner, scopes, custom_attributes: nil, include_expired: true)

Returns:
  • (Doorkeeper::AccessToken, nil) - Access Token instance or

Parameters:
  • custom_attributes (Nilable Hash) --
  • scopes (String, Doorkeeper::OAuth::Scopes) --
  • resource_owner (ActiveRecord::Base, Integer) --
  • application (Doorkeeper::Application) --
def matching_token_for(application, resource_owner, scopes, custom_attributes: nil, include_expired: true)
  tokens = authorized_tokens_for(application&.id, resource_owner)
  tokens = tokens.not_expired unless include_expired
  find_matching_token(tokens, application, custom_attributes, scopes)
end