Skip to content

MQTT 5.0 Enhanced Authentication - SCRAM

This authenticator implements Salted Challenge Response Authentication Mechanism (SCRAM) authentication and uses the built-in database of EMQX to store client credentials (users).

SCRAM is a more complicated mechanism than password verification. It requires exchanging additional MQTT packages during connection. SCRAM authentication does not depend on external data sources, and it is simple and lightweight to use.

TIP

SCRAM authenticator only supports MQTT 5.0 connection.

Configure with Dashboard

On EMQX Dashboard, click Access Control -> Authentication on the left navigation tree to enter the Authentication page. Click Create at the top right corner, then click to select SCRAM as Mechanism, and Built-in Database as Backend. This will lead you to the Configuration tab.

Set Password Hash as sha256 or sha512 and click Create to finish the settings.

Configure with Configuration Items

Sample configuration:

hcl
{
    mechanism = scram
    backend = built_in_database
    algorithm = sha512
    iteration_count = 4096
}

where,

  • algorithm: password hash algorithm, options: sha256 and sha512
  • iteration_count (optional): Iteration-count parameter for SCRAM; Default: 4096

Authentication Flow

scram_workflow