Ruby on Rails HTTP Basic authentication with JSON failure message

A short snippet on how to make Ruby on Rails authenticate_or_request_with_http_basic respond with a JSON valid message upon failure.

class ApplicationController 

Cover photo by Vladimer Shioshvili on Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) license.

The post Ruby on Rails HTTP Basic authentication with JSON failure message appeared first on Running with Ruby.

Leave a Comment

Your email address will not be published. Required fields are marked *