> For the complete documentation index, see [llms.txt](https://docs.fortifiedid.se/access/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortifiedid.se/access/key-components/authenticators/credential-validators/username-and-password.md).

# Username & password

Used to verify user credentials against one or more user stores. Requires modules AuthN & Pipes to be deployed.

## Configuration

{% hint style="info" %}
**Authenticator type:** `UserNameAndPassword`
{% endhint %}

Common Authenticator configuration can be found [here](/access/key-components/authenticators/common-configuration.md).

{% tabs %}
{% tab title="Properties" %}

<table data-full-width="true"><thead><tr><th>Name</th><th>Description</th><th>Default value</th><th data-type="checkbox">Mandatory</th></tr></thead><tbody><tr><td><code>pipe_id</code></td><td>Pipe to use for validation.</td><td>N/A</td><td>true</td></tr><tr><td><code>allowed_retries</code></td><td>Numer of allowed faulty tries before system resets the state.</td><td><code>2</code></td><td>false</td></tr><tr><td><code>webroot_dir</code></td><td>See common authenticator configuration</td><td>web/authenticator/username_password</td><td>false</td></tr><tr><td><code>custom_identifier</code></td><td>Tag used for event separation</td><td>N/A</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Example" %}

```json
{
  "id": "uidpwd01",
  "type": "UserNameAndPassword",
  "config": {
    "base_path": "${globals.default_login_suffix}",
    "pipe_id": "user_validation_pipe"
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Property *base\_path* should not contain the full path when used in conjunction with the [Selector](/access/key-components/authenticators/flow-control/selector.md), instead, the full URI will be handled by the selector. The full path will be *base\_path + / + id*.
{% endhint %}

## Logging

Apart from system logging, event logging is done when completing and failing a transaction.

Event ids are:

* WEB\_100017("Authenticated using User-name & password")
  * IDENTIFIER (user trace id)
  * CUSTOMER\_IDENTIFIER (if configured)
  * SOURCE\_USER\_NAME (username entered by the user)
  * SOURCE\_ADDRESS (ip of the remote session)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)
* WEB\_100018("Failed authentication using User-name & password")
  * IDENTIFIER (user trace id)
  * CUSTOMER\_IDENTIFIER (if configured)
  * SOURCE\_ADDRESS (ip of the remote session)
  * SOURCE\_USER\_NAME (username entered by the user)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)

### Data sent to validation pipe

On validation, data sent to the pipe is:

* identifier - the username provided by the user
* password - the password provided by the user

## Data exposed to global state

After a user completes a transaction, the authenticator is marked as done. Data from the authentication response is then put into the global state replacing existing values:

* username

## API

### Starting an authentication

Start by sending in a Ajax request containing identifier & password:

```json
{
    "type": "start",
    "data": {
        "identifier": "<user_data>",
        "password": "<user_password>"
    }
}
```

The response back will contain either a COMPLETED or ERROR:

```json
{
    "status": "COMPLETED"
}
```

## Translation keys

```json
{
  "username_password.identifier": "Username",
  "username_password.password": "Password",
  "username_password.start_authentication": "Sign in",
  "username_password.authentication_verified": "Identity verified",
  "username_password.redirecting": "Redirecting...",
  "username_password.cancel": "Cancel",
  "username_password.ERROR": "Wrong username or password.",
  "allow-cookies-body": "To save your language settings on this device you need to approve a language cookie.",
  "allow-cookies-button": "Approve language cookie",
  "authentication.help_text": "",
  "change_language": ""
}
```

```json
{
  "username_password.identifier": "Användarnamn",
  "username_password.password": "Lösenord",
  "username_password.start_authentication": "Logga in",
  "username_password.authentication_verified": "Identitet verifierad",
  "username_password.redirecting": "Omdirigerar...",
  "username_password.cancel": "Avbryt",
  "username_password.ERROR": "Felaktigt användarnamn eller lösenord",
  "allow-cookies-body": "Vill du spara dina språkinställningar på denna enhet behövs ett godkännande av  språk-cookie.",
  "allow-cookies-button": "Godkänn språk-cookie",
  "authentication.help_text": "",
  "change_language": ""
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fortifiedid.se/access/key-components/authenticators/credential-validators/username-and-password.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
