How to authenticate to device API when using official mender client

Hello,
I am developing an application to manage update from the device. I intend to rely on mender client check-update command, but I would like to use the server-side device check-update API to check if there is an deployment awaiting.

In order to build the request, I need a JWT token from the server.

Is getting the JWT token using the device-side API the only way to go if I use official mender client? Because after mender setup, I cannot find the public key used by the mender client and needed to fetch the JWT through the device authentication API.

I know that upon the first authentication request, the public key is available from the server GUI, but if there was a way to get the public key from the device without extra manipulations, it would be nice. And the only way I see right now is with the device-side API.

Please tell me if I read the situation correctly.

Thanks!

This post provides the answer, I would say.