Skip to content
Open dashboard (opens in a new tab)

Authentication

Authentication

Most of an application sits behind a login. An authentication tells NightVision how to sign in, so a scan tests the pages and API endpoints a real user reaches, not only the login page.

In the dashboard: Authentications

Open Authentications (opens in a new tab)

You create an authentication once, assign it to one or more applications, and every scan of those applications uses it.

Type Use it when How it works
Recorded login Users sign in through a web page: a form, single sign-on, or a form plus a one-time code You log in once in a browser. NightVision saves the steps as a Playwright script and replays them at the start of each scan
Generated login script The login is a plain username and password form and you would rather not record it With one API request you give NightVision the application, a username and a password. It writes the script for you
Header The application accepts a fixed token, such as a bearer token or an API key NightVision sends the header with every request
Cookie header You already hold valid session cookies NightVision sends them as one Cookie header with every request
Token from a pipeline An API issues short-lived tokens from an endpoint and a CI job scans it The job requests a token, stores it in a header authentication and scans

Two related features are not authentications:

  • Extra headers belong to an application and go out on every request whatever the authentication is. Use them for tenant ids, firewall bypass headers and similar values.
  • MFA and TOTP is a setting on a recorded login, for logins that ask for a one-time code.

Select Authentications in the left rail to see every authentication in the projects you have chosen in the project scope.

The Authentications page listing header, cookie header and recorded login authentications with their project, latest login and application count.
The Authentications page. Recorded logins show the result of their latest login.

Each row shows:

  • Type: Recorded login, Header or Cookie header. An MFA chip marks a recorded login with a one-time code configured.
  • Project: the project the authentication belongs to. An authentication stays in its project and can only be assigned to applications in the same project.
  • Latest login: what the newest scan that used the authentication says about the login. The dots show its last three scans, newest first. See Login health.
  • Applications: how many applications use it.
  • Last used: when a scan last ran with it.

Use Search by name, Type and Latest login to filter the list. The row menu holds Edit, Duplicate (recorded logins only) and Delete.

Open an authentication to see three tabs:

  • Login history (or Runs for headers and cookies): every scan and login check that used it. Select a row to open that run’s login status.
  • Applications: the applications it is assigned to.
  • Script and settings (or Stored values and settings): the recorded script or the stored header and cookie names, plus the project, description and MFA settings.
  1. Select Authentications, then New authentication.
  2. Choose the Project. Only projects where you can manage authentications are listed.
  3. Under Authentication type, choose Recorded authentication (Playwright), Header authentication or Cookie header authentication.
  4. Fill in the fields for that type and finish with Generate command (recorded) or Create (header and cookie).
The Create new authentication dialog with the three authentication types and the name and Login URL fields.
Choose the project and the authentication type.

Names take letters, numbers, hyphens and underscores, up to 100 characters, and are unique within a project.

The steps for each type are on Recorded logins and Headers and cookies. You can also create one while starting a scan: on New scan, select Add authentication next to the Authentication field.

Assign an authentication to an application

Section titled “Assign an authentication to an application”

An application uses one authentication at a time. An authentication can serve many applications.

  1. Open the application from Applications.
  2. In the Authentication section of the Setup tab, select Assign authentication.
  3. Pick the authentication and select Save.
The Assign authentication dialog with a recorded login selected and the option to run scans signed out.
Pick the authentication the application's scans log in with.

To stop using an authentication, choose None, scans run signed out. To use a different one for a single scan, change the Authentication field on New scan.

The Applications tab of an authentication lists every application that uses it.

The Applications tab of a recorded login listing three applications with their type, project and last scan time.
The applications assigned to one recorded login.

At the start of a scan NightVision signs in before it crawls or tests anything:

  • Recorded login. NightVision opens a browser, replays the script step by step, fills each placeholder with its stored value and generates a one-time code if MFA is configured. It keeps the session the login produced and uses it for the rest of the scan. It takes a screenshot at each step so you can see what happened.
  • Header and cookie header. There is no login step. The stored values are attached to every request.

For a recorded login, New scan offers Re-authenticate before the active scan. With it on, NightVision replays the login a second time after the crawl, so a session that expired during a long crawl does not leave the active checks signed out. It is on by default for scans of two hours or more.

To see the playback of one scan, open the scan, select Details, then Login status. Login check explains that screen.

NightVision reports the state of every recorded login so a broken one does not go unnoticed.

Where What you see
Authentications list, Latest login Logged in, Login failed, Unknown, Not used yet, or No login flow for headers and cookies
An authentication’s page A warning when the latest scan did not get in, with Re-record login
Applications list and an application’s page Logged in, Login failed, Last scan ran signed out, Login not verified, No login flow or No authentication. A failing login adds an alert naming the last step that worked
A scan’s page A Signed out chip in the header when the run tested the application without a session
A scan’s Details > Login status The login status of each attempt, the script, and the screenshots

A failed login does not stop you from scanning, but the scan runs signed out and pages behind the login are not tested.

Each replay of a recorded login ends in one of these statuses. They appear in Login history and on a scan’s Login status.

Status What it means What to do
Script complete Every step of the script ran Nothing. Add a login check to confirm the session reaches a signed-in page
Not logged in The script ran but the page still looks signed out Check the username and password, then re-record
Failure A step could not run, for example a button was renamed Edit the script or re-record
Two-factor prompt The login stopped at a one-time code Configure MFA, or pick the right placeholder
CAPTCHA The login page showed a CAPTCHA Turn the CAPTCHA off for the scan account or allow NightVision’s addresses
Bot detected The site blocked the browser as automated Allow NightVision through your bot protection, or add an extra header your firewall trusts
Device verification The site asked to confirm a new device Turn device checks off for the scan account
Knowledge verification The site asked a security question Use an account without security questions
See what’s new page An announcement page appeared after sign-in Dismiss it once for the scan account, or re-record and include the dismiss step
Unknown The run reported no login state Run a login check

Troubleshooting scans covers what to do when a scan runs signed out.

  • Passwords and other values you type while recording are replaced in the script by placeholders such as {{0}}. The values are stored encrypted, apart from the script.
  • Header values, cookie values and MFA seeds are stored encrypted.
  • After you save, NightVision never shows a stored value again, in the dashboard, the CLI or the API. To change one, enter a new value.

Use a dedicated test account for scanning, not a real user’s account.

Anyone who can see a project can see its authentications. Creating, editing, assigning and deleting need permission to manage authentications in that project. Without it the buttons are hidden or disabled with the reason. See Members and roles.

Deleting an authentication asks you to type its name. Applications that used it scan signed out afterwards.

The CLI calls an application a target and files authentications under auth.

Terminal window
# List authentications in the current project, or in every project
nightvision auth list
nightvision auth list --all
# Scan with an authentication, by name
nightvision scan my-app --auth my-login
# Delete one
nightvision auth delete my-login

The create and update commands are on the page for each type. CLI command map lists them all.

The API calls authentications credentials.

Task Endpoint
List or read GET /api/v1/credentials/, GET /api/v1/credentials/{id}/
Create POST /api/v1/credentials/script/, POST /api/v1/credentials/header/, POST /api/v1/credentials/cookie/
Assign to applications POST /api/v1/credentials/{id}/assign-to-targets/ with {"targets": ["<id>"]}
Remove from applications POST /api/v1/credentials/remove-from-targets/ with {"targets": ["<id>"]}
Latest login status GET /api/v1/credentials/{id}/login-status/

See the API overview for tokens and the base URL.