> For the complete documentation index, see [llms.txt](https://security.navidnaf.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://security.navidnaf.com/platform-9-3-4/auth-auth/authentication/password-based-authentication.md).

# Password-based Authentication

Password-based authentication is a security mechanism where a user gains access to a system or application by entering a password that matches the one stored in the system's database.

```python
# Example of password-based authentication in Python

# Simulated user database
user_db = {"username": "user1", "password": "securepassword123"}

def authenticate(username, password):
    if username in user_db and user_db["password"] == password:
        return "Authentication successful!"
    else:
        return "Authentication failed!"

# User input
input_username = input("Enter username: ")
input_password = input("Enter password: ")

# Authentication check
print(authenticate(input_username, input_password))
```

This code snippet simulates a basic password-based authentication process by checking the entered username and password against a predefined user database.
