Authentication
Recorded logins
A recorded login is a browser login you perform once. NightVision saves the steps as a Playwright script and replays them at the start of every scan. It works with login forms, single sign-on redirects and one-time codes.
In the dashboard: Authentications
Open Authentications (opens in a new tab)Recording happens on your machine, in a Chrome window the NightVision CLI opens. You can start it from the dashboard, which builds the command for you, or run the CLI directly.
Before you start
Section titled “Before you start”- Install the CLI and sign in with
nightvision login. See Install the CLI. - Have a test account for the application. Use a dedicated scan account, not a real user’s.
- Your machine must be able to reach the login page. The application does not have to be public to record a login.
Record from the dashboard
Section titled “Record from the dashboard”-
Select Authentications, then New authentication.
-
Choose the Project.
-
Under Authentication type, keep Recorded authentication (Playwright). Under How would you like to set this up?, keep Create new.
-
Enter an Authentication name, an optional Description, and the Login URL, the page where the login starts. NightVision checks whether it can reach the page and tells you the result under the field. If it cannot, you can still record from your machine.
-
Select Generate command.
-
Copy the command from the macOS and Linux or Windows tab and run it in a terminal.

The dashboard builds the record command and waits for the upload. -
A Chrome window opens on the login URL. Log in as you normally would, including any single sign-on redirect or one-time code.
-
Once you are logged in, close the Chrome window. The CLI uploads the recording.
-
The dialog changes from Waiting for your recording to Recording received. Select Configure MFA if the login used a one-time code (see MFA and TOTP), then Done.
The new authentication appears on the Authentications page. Assign it to an application to use it.
Record from the CLI
Section titled “Record from the CLI”nightvision auth playwright create my-login https://app.example.com/loginThe two arguments are the authentication name and the login URL. Chrome opens, you log in, you close the window, and the CLI uploads the script and prints a link to it in the dashboard.
| Flag | What it does |
|---|---|
-d, --description |
Sets a description |
-p, --project |
The project name. Without it the CLI uses the project you set with nightvision project set |
-P, --project-id |
The project id, in place of the name |
--save <path> |
Also writes the recorded Playwright file to a local path |
Then scan with it:
nightvision scan my-app --auth my-loginWhat gets saved
Section titled “What gets saved”The script is the list of steps: the pages visited, the fields filled and the buttons clicked. Every value you typed is replaced with a numbered placeholder, in the order you typed them:
page.goto("https://app.example.com/login")page.get_by_label("Email").fill("{{0}}")page.get_by_label("Password").fill("{{1}}")page.get_by_role("button", name="Sign in").click()The typed values are stored encrypted, apart from the script, and are filled back in only when a scan replays the login. NightVision never shows them again.
Open the authentication and select Script and settings to read the script. The line below it lists the placeholders and their line numbers.

Tips for a recording that replays well
Section titled “Tips for a recording that replays well”- Start from the login page itself, not from a page that redirects to it.
- Log in the way a user does, through the page. Each value you type becomes one placeholder.
- Stop as soon as you are signed in. Clicks after that become steps every scan repeats.
- If the login asks for a one-time code, type the current code while recording, then configure MFA so scans generate a fresh one.
- Keep it short. A script holds up to 5,000 characters.
Check that it works
Section titled “Check that it works”Open the authentication and select Run login check. It replays the login without scanning and reports whether the session is signed in. See Login check.
The Login history tab lists every scan and login check that used the authentication, with the login status of each. Select a row to open that run’s screenshots.

The statuses are explained in Login statuses.
Re-record a login
Section titled “Re-record a login”Re-record when the login flow changes, the password changes, or the latest login failed. Re-recording replaces the script and the stored values. The name, the project and the applications that use the authentication stay the same.
-
Open the authentication and select Re-record. A failing login also shows Re-record login in its warning, on the authentication and on each application that uses it.
-
Copy the command and run it in a terminal.

Re-record login builds the update command for this authentication. -
Log in again in the Chrome window and close it.
-
When the dialog shows Recording received, select Close. Scans log in with the new recording from their next run.
From the CLI:
nightvision auth playwright update my-login --scriptIf MFA is configured and the new recording changes the line that fills the one-time code, the MFA placeholder is cleared. Scans then run without a code until you pick the placeholder again.
For a small change, such as a renamed button, edit the script in the browser instead.
Rename it or change the login URL
Section titled “Rename it or change the login URL”Select Edit on the authentication to change the name, the description or the Login URL. Changing the login URL rewrites the first page.goto() in the script to match. To record the login again at the new address, select Generate command in the same dialog.
From the CLI:
Flag on nightvision auth playwright update <name> |
What it does |
|---|---|
-n, --name |
Renames the authentication |
-d, --description |
Changes the description |
-u, --url |
Sets a new login URL and records the login again there |
-s, --script |
Records the login again at the current URL |
--save <path> |
Also writes the new recording to a local path |
-p, --project or -P, --project-id |
The project the authentication is in |
From the API
Section titled “From the API”| Task | Endpoint |
|---|---|
| Create from a script you already have | POST /api/v1/credentials/script/ with name, project, script_first_url and script_content |
| Read, rename or replace the script | GET and PUT /api/v1/credentials/{id}/ |
| Delete | DELETE /api/v1/credentials/{id}/ |
Stored values are never returned. Each comes back as its placeholder.
Next steps
Section titled “Next steps”- Login check confirms a recorded login still works before you spend a scan.
- Headers and cookies covers APIs that sign in with a token or a key.
- Authenticate an API in a pipeline requests a fresh token before each scan.
- Scan from a pipeline runs scans from CI with the login you recorded.