Login form
How to configure login form authentication for Snyk API and Web targets
Configure login form authentication to scan protected areas of your web application that require a username and password login.
Websites and applications can have restricted areas available only to authenticated users. Configuring authentication lets Snyk API & Web access these protected areas and identify vulnerabilities within the full scope of your target.
Create a dedicated user account for testing rather than using a real user account. Snyk submits forms and clicks buttons during scans, which can create unwanted data in the account.
Prerequisites
You must have added the target to Snyk API & Web
Your application uses a standard HTML login form with username and password fields
Navigate to login configuration
From the Targets page, locate your target in the list.
Click the gear icon to access the target settings.
Select the Authentication tab.
Click the Login Form button to display the configuration form.
Add the login page URL
Specify the URL where the authentication process begins. In most cases, this is the page URL where you enter the credentials.
If you use Single Sign-On or need to visit a specific URL that redirects to the credentials page, specify that initial URL.
Examples:
If your target's main page (
https://example.com/) shows the form where credentials are entered, set the login form URL tohttps://example.com/If the path that shows the form is
/login, set the login form URL tohttps://example.com/loginIf a specific path redirects to the login form when the user is not logged in:
/or/loginredirects to/login-page?redirectTo=%2Fdashboard: Set the login form URL tohttps://example.com/orhttps://example.com/login/or/loginredirects tohttps://auth0.example.com: Set the login form URL tohttps://example.com/orhttps://example.com/login
Configure field pairs
Add field name and value pairs for each input field in your login form.
Add username or email field
Obtain the field name by right-clicking the field and selecting Inspect.
In the HTML, find the
name,id, or CSS selector for the field.

For the example above, the field name could be any of:
username(name attribute)username_id(id attribute)form.login-form input[type="email"](CSS selector)#username_id(CSS selector using ID)
Enter the field name and the actual username or email address (for example,
admin@example.comorExampleUser1).Click Add.
Add password field
Repeat the process for the password field:
Inspect the password field to obtain its
name,id, or CSS selector.Enter the field name and the actual password value.
Click Add.
Add additional fields (if needed)
If your login form requires additional fields beyond username and password, repeat this process for each field.
Add submit button (optional)
In most cases, Snyk automatically detects and clicks the correct submit button. However, you might need to specify the submit button if:
The submit button is outside the
<form>tagThe login inputs are not inside a
<form>tagYour login form uses a non-standard structure
To specify the submit button:
Create a new field with the name
submit_button.In the value field, enter the CSS selector for the button (for example,
#login-form-container button[type="submit"]).Click Add.
Save and enable
Review your configuration.
Click Save and enable.
You can disable or enable this authentication anytime using the Off/On toggle button, or delete the configuration using the Delete button.
Last updated
Was this helpful?

