Page 7: basic authentication

A high-level basic access authentication request guard for ✨


Recently, I’ve created a simple library called rocket-basicauth which allows a high-level interface to basic access authentication using request guards, as an extension for the web framework ✨


Here is the jist of the entire functionality of this library:

/// Hello route with `auth` request guard
fn hello(auth: BasicAuth, age: u8) -> String {
    format!("Hello, {} year old named {}!", age,

This example excludes the use rocket; imports and main function setups and just shows the crux of this library; the “BasicAuth” structure, documented here.

Here are some links to find out more about this quick library: