I am following railscast on how to set authentication tokens
http://railscasts.com/episodes/352-securing-an-api?view=asciicast
I have a very well configured application and it uses the authenticate_or_request_with_http_token method to get the token.
My problem is that I have the following application which should set the token in the header. Sort of:
uri = URI.parse(full_url)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request['HTTP_AUTHORIZATION'] = 'this_is_a_test_key'
response = http.request(request)
The code above is denied access. I know it is easy to set custom ones like X-CUSTOM-TOKEN, but how to set the default value?
source
share