Skip to content

AUTH

Authenticates the current connection.

AUTH [username] password
ParameterTypeRequiredDescription
usernamestringNoUsername for named-user authentication
passwordstringYesPassword to authenticate with

Simple string OK on successful authentication.

Supports two authentication modes:

  • Default user mode (1 parameter): Checks the provided password against the auth.requirepass configuration value.
  • Named user mode (2 parameters): Checks the provided username and password against the auth.users.<username> configuration.

On successful authentication, the session is marked as authenticated.

This command does not require the cluster to be initialized.

ErrorCondition
WRONGPASSInvalid username or password
ERRNo password is configured but AUTH was called with a single parameter

Default user authentication:

127.0.0.1:5484> AUTH mysecretpassword
OK

Named user authentication:

127.0.0.1:5484> AUTH admin mysecretpassword
OK

Wrong password:

127.0.0.1:5484> AUTH wrongpassword
(error) WRONGPASS invalid username-password pair or user is disabled.