You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: device_flow_activation_controller.rb
    path of file: ./repos/Autolab/app/controllers
    
    the code of the file until where you have to start completion: # controls the page that allows users to grant api access to clients
# that use device flow
class 
    
  def authorization_callback
    req = OauthDeviceFlowRequest.find_by(user_code: params[:state])

    if req.nil?
      flash[:error] = "Invalid request"
      redirect_to(action: :index) && return
    end