title: Spree API Authentication extension not working
body: <p>I'm working on an extension to authenticate users over the Spree API. I have search a lot but almost no information exits on this topic, and the few extensions I have found doesn't work.</p>
  
  <p>I created a extension based on the ones I have found and I'm getting the following error:</p>
  
  <p>AbstractController::ActionNotFound (The action 'sign_in' could not be found for Spree::UsersController)</p>
  
  <pre><code>module Spree
    module Api
  
        #class UsersController &lt; Spree::Api::V1::UsersController 
        Spree::Api::V1::UsersController.class_eval do
          before_action :authenticate_user, :except =&gt; [:sign_up, :sign_in]
  
          def sign_up
  
            @user = Spree::User.find_by_email(params[:user][:email])
  
            if @user.present?
              render "spree/api/users/user_exists", :status =&gt; 401 and return
            end
  
            @user = Spree::User.new(user_params)
            if !@user.save
              unauthorized
              return
            end
            @user.generate_spree_api_key!
          end
  
          def sign_in
            puts("hola controller")
            @user = Spree::User.find_by_email(params[:user][:email])
            if !@user.present? || !@user.valid_password?(params[:user][:password])
              unauthorized
              return
            end
            @user.generate_spree_api_key! if @user.spree_api_key.blank?
          end
  
  
          def user_params
            params.require(:user).permit(:email, :password, :password_confirmation)
          end
  
  
      #end
      end
    end
  end
  </code></pre>
  
  <p>My routes.rb</p>
  
  <pre><code>Spree::Core::Engine.add_routes do
    # Add your extension routes here
    namespace :api, defaults: {format: 'json'} do
      resource :users do
          #resource :v1 do
          member do
            #post :sign_up
            post :sign_in
          end
      #end
      end
    end
  end
  </code></pre>
  
  <p>Can you please help me figuring out what am I missing?</p>
  
  <p>Thanks</p>