Daron
Daron

Reputation: 329

Rails Receiving HTTP POST Request

Is there a clear, step-by-step source of information about how to program Rails to receive an HTTP POST Request that is encoded with JSON and uses Basic HTTP Authentication? I've been literally looking for weeks now and am so frustrated.

Upvotes: 0

Views: 130

Answers (1)

jgraft
jgraft

Reputation: 938

If I understand you correctly, Rails has this built-in.

Here's an example which you would put at the top of your controller. This would be for all actions in the controller and not just post requests.

class SomeController < ApplicationController    
  http_basic_authenticate_with name: "dhh", password: "secret"

Documentation is here: Rails documentation for http basic authenticate

Upvotes: 1

Related Questions