Prerequisites
If you want to connect to the database from a MySQL client, the MySQL client version must be 9.1 or later. From 9.1, theauthentication_openid_connect_client plugin ships with all MySQL client distributions, community distributions included.
Create a user with JWT
When creating a user, specify the authentication method as JWT byIDENTIFIED WITH authentication_jwt [AS '{xxx}']. {xxx} is the JWT properties of the user. In addition to the following method, you can configure the default JWT properties in the FE configuration file. You need to manually modify all fe.conf files and restart all FEs for configuration to take effect. After the FE configurations are set, the database will use the default properties specified in your configuration file and you can omit the AS '{xxx}' part.
Syntax:
Example:
Connect from MySQL client with JWT
To connect from a MySQL client to the database using JWT, you need to enable theauthentication_openid-connect_client plugin, and pass the necessary token (using the path to the token file) to authenticate the mapped user.
Syntax:
Connect over HTTP or Arrow Flight with JWT
Users of a JWT security integration can also send the token asAuthorization: Bearer <token> to the HTTP API (SQL API, Stream Load, Web UI) and to Arrow Flight SQL, with no user name. See Connect over HTTP and Arrow Flight.
A user created with IDENTIFIED WITH authentication_jwt can present its token only over the MySQL protocol, where the handshake carries the user name. To use a JWT on the HTTP API or Arrow Flight SQL, create a JWT security integration instead, and see Where each authentication method works.