I'm trying to create a Session from a single_access_token, passed in the HTTP request using ?user_credentials=<the key>.
class ApplicationController < ActionController::Base
....
protected
def current_base_station
return @current_base_station if defined?(@current_base_station)
@current_base_station = current_base_station_session && current_base_station_session.base_station
end
def current_base_station_session
@current_base_station_session = BaseStationSession.create(params)
puts @current_base_station_session.inspect
end
private
def require_base_station
unless current_base_station
# return an auth failure here
return false
end
end
....
end
I call require_base_station as a before_filter from my API controller.
The line after the BaseStationSession.create outputs the following:
#<BaseStationSession: no credentials provided>
I've confirmed that the params hash is as expected:
Started GET "/base_stations/1?user_credentials=an_api_key" for 127.0.0.1 at Thu Sep 29 11:08:02 -0700 2011
Processing by BaseStationsController#show as HTML
Parameters: {"user_credentials"=>"an_api_key", "id"=>"1"}
I've tried passing various options to the create method, but I get the same "no credentials provided" every time. What am I doing wrong here?
Thanks for your help!
--
David van Geest
Software Engineer
Spindance, Inc.
616.355.7000 x113