Form Login icon

Form Login

Returns a session token after performing a login

Overview

This node performs a form-based login by sending a POST request to a specified authentication URL with user credentials. It returns the full HTTP response, which typically contains session tokens or cookies needed for subsequent authenticated requests. This node is useful when automating workflows that require logging into web services or applications that use standard HTML form authentication.

Practical examples:

  • Logging into a custom web portal to retrieve session cookies for further data scraping.
  • Automating login to an internal company system before performing API calls that require authentication.
  • Integrating legacy systems that do not provide modern API authentication but rely on form-based login.

Properties

Name Meaning
Authentication URL The URL endpoint where the login form is submitted (e.g., https://example.com/login).
Username Field The name attribute of the username input field in the login form (e.g., username).
Password Field The name attribute of the password input field in the login form (e.g., password).

Output

The node outputs an array containing one JSON object representing the full HTTP response from the login request. This includes status code, headers, and body content. The response is not automatically parsed as JSON; it reflects the raw server response, which often contains session tokens or cookies necessary for authenticated sessions.

If the login is successful, the output can be used to extract session information for subsequent requests in the workflow.

Dependencies

  • Requires an API key credential containing the username and password to authenticate.
  • No external libraries beyond n8n's built-in HTTP request helper are used.
  • The node expects the target login endpoint to accept form-encoded POST requests.

Troubleshooting

  • Incorrect credentials: If the username or password is wrong, the server may return an error or redirect. Check the output HTTP status and response body for clues.
  • Wrong field names: Ensure the "Username Field" and "Password Field" exactly match the form field names expected by the login page.
  • Redirects not followed: The node disables automatic redirect following. If the login flow relies on redirects, this might cause unexpected results.
  • Non-form login: This node only supports form-based login via POST with URL-encoded parameters. It will not work with other authentication methods like OAuth or JSON payloads.
  • HTTP errors: The node ignores HTTP status errors to allow inspection of the full response. Users should manually check the status code in the output.

Links and References

Discussion