HTTP Auth 401 Even on Valid Login


#1

I can’t understand why authenticate_or_request_with_http_basic keeps
failing even though I am entering the correct info.

If I try to access /admin/items/new, I enter the correct info but I
keep getting prompted.

The strange part is that when I cancel out, I get “HTTP Basic: Acce”.

Here’s the controllers:

class Admin::BaseController < ApplicationController
before_filter :authenticate
def authenticate
authenticate_or_request_with_http_basic do |name, pass|
name == ‘h’ && pass == ‘x’
end
end
end

class Admin::ItemsController < Admin::BaseController
def new
@item = Item.new
@category = ‘New Item’
@categories = Category.find :all, :order=>‘name’
end

#etc
end

The log:

Processing ItemsController#new (for localhost at 2009-05-03 12:20:05)
[GET]
Session ID:
BAh7CDoSYXV0aGVudGljYXRlZFQ6DGNzcmZfaWQiJTYxZjNiYjBlY2Q2MWYz
MTA3ZmQ0Y2ZiOTFhMmRlMWQxIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy
OjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–
f03480a81df51ccf0c5d4a2a6e80f3aad10366cc
Parameters: {“action”=>“new”, “controller”=>“admin/items”}
Filter chain halted as [:authenticate] rendered_or_redirected.
Completed in 0.00136 (733 reqs/sec) | Rendering: 0.00112 (82%) | DB:
0.00000 (0%) | 401 Unauthorized [http://localhost/admin/items/new]