> For the complete documentation index, see [llms.txt](https://docs.vernemq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vernemq.com/1.7.1/plugindevelopment/enhancedauthflow.md).

# Enhanced Auth Flow

VerneMQ supports [enhanced authentication](http://docs.oasis-open.org/mqtt/mqtt/v5.0/cs02/mqtt-v5.0-cs02.html#_Toc514345528) flows or SASL style authentication for MQTT 5.0 sessions. The enhanced authentication mechanism can be used for initial authentication when the client connects or to re-authenticate clients at a later point.

![](https://2229384336-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LOvr-CQz8jJxldqmC1L%2F-LQhdfb10wt-6bNmhOwP%2F-LQhdiYOZTqZcZdCRvGj%2Fenhanced_authflow.svg?generation=1541585431708788\&alt=media)

The `on_auth_m5` hook allows the plugin to implement SASL style authentication flows by either accepting, rejecting (disconnecting the client) or continue the flow. The `on_auth_m5` hook is specified in the Erlang behaviour [on\_auth\_m5\_hook](https://github.com/vernemq/vernemq_dev/blob/master/src/on_auth_m5_hook.erl) in the [vernemq\_dev](https://github.com/vernemq/vernemq_dev) repo.
