class Doorkeeper::OAuth::RefreshTokenRequest

def create_access_token

def create_access_token
  attributes = {}.merge(custom_token_attributes_with_data)
  resource_owner =
    if Doorkeeper.config.polymorphic_resource_owner?
      refresh_token.resource_owner
    else
      refresh_token.resource_owner_id
    end
  if refresh_token_revoked_on_use?
    attributes[:previous_refresh_token] = refresh_token.refresh_token
  end
  # RFC6749
  # 1.5.  Refresh Token
  #
  # Refresh tokens are issued to the client by the authorization server and are
  # used to obtain a new access token when the current access token
  # becomes invalid or expires, or to obtain additional access tokens
  # with identical or narrower scope (access tokens may have a shorter
  # lifetime and fewer permissions than authorized by the resource
  # owner).
  #
  # Here we assume that TTL of the token received after refreshing should be
  # the same as that of the original token.
  #
  @access_token = Doorkeeper.config.access_token_model.create_for(
    application: refresh_token.application,
    resource_owner: resource_owner,
    scopes: scopes,
    expires_in: refresh_token.expires_in,
    use_refresh_token: true,
    **attributes,
  )
end