Adding password protection to a project

You may want an efficient way to add password protection to an entire static site or client-side application, whether it’s intended for internal use or just a temporary measure while you work on a project with a client. This is possible with Surge Plus!

Logging into a static with password protection on Surge.
This is an example of basic password protection on a static site. It will work with any static site, hand-coded site, or client-side application.

Create an AUTH file in the root of the directory you publish using Surge. Pasting the following into the file will password protect your project, with the username kenneth and password 12345:

kenneth:12345

The first time you re-publish with an AUTH file in your project, you’ll automatically be prompted to upgrade your project to Surge Plus, right from the CLI.

Multiple Accounts

You may also specify multiple basic accounts to authenticate against:

brock:password1
kenneth:password2
kim:password3