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.

Ubuntu Server Admin

Recent Posts

How to Install Pi-hole on Ubuntu VPS Server

Pi-hole is a network-wide ad blocker that acts as a DNS sinkhole. It’s an effective…

5 days ago

Dirty Frag Linux kernel local privilege escalation vulnerability mitigations

Two local privilege escalation (LPE) vulnerabilities affecting the Linux kernel have been publicly disclosed on…

6 days ago

Ubuntu 26.04 (Resolute Raccoon) Now Available for VPS Servers

Users now have additional Operating System choices to use with Ubuntu VPS servers. Ubuntu 26.04…

6 days ago

From Karafka Ractors to Yoichi Whisky: My RubyKaigi 2026 Experience

Introduction I just returned from RubyKaigi 2026, held from April 22nd to 24th in Hakodate,…

7 days ago

Three weeks to go: A sneak peek of the Ubuntu Summit 26.04 experience

The countdown to the Ubuntu Summit is officially on! We are just three weeks away…

1 week ago

How to use Ubuntu on Windows

Why run Ubuntu on Windows? It’s about getting the best of both worlds. Many organizations…

1 week ago