A Deep Dive Into Token-Based Authentication and OAuth 2.0 in MQTT
This article delves into additional authentication methods beyond those covered in previous articles.
Specifically, we will explore token-based authentication and OAuth 2.0, explaining their concepts and demonstrating their implementation in MQTT.
Let’s first look at token-based authentication and see some of the benefits over username and password authentication.
What Is Token-Based Authentication?
As the name implies, token-based authentication uses tokens to authenticate a client instead of its credentials such as username and password. This is similar to an electronic key to a hotel room. You show your id to the receptionist and they give you an electronic key that allows you access to your room. This electronic key performs the function of a token for the duration of your stay. You don’t need to keep identifying yourself to the receptionist every time you want to enter the room; you just use your key.