# How to authenticate to device API when using official mender client

**URL:** <https://hub.mender.io/t/how-to-authenticate-to-device-api-when-using-official-mender-client/4688>\
**Category:** General Discussions\
**Tags:** api, authentication\
**Created:** [February 25, 2022, 4:35pm UTC](https://hub.mender.io/t/how-to-authenticate-to-device-api-when-using-official-mender-client/4688 "2022-02-25T16:35:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)\
**Post date:** [February 25, 2022, 4:35pm UTC](https://hub.mender.io/t/how-to-authenticate-to-device-api-when-using-official-mender-client/4688/1 "2022-02-25T16:35:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![francoislefebvre](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/francoislefebvre/32/1238_2.png) [@francoislefebvre](https://hub.mender.io/u/francoislefebvre)\
**Post date:** [February 28, 2022, 6:43pm UTC](https://hub.mender.io/t/how-to-authenticate-to-device-api-when-using-official-mender-client/4688/2 "2022-02-28T18:43:36Z")

</div>

This [post](https://hub.mender.io/t/automatic-and-manual-updates-from-server/2802/9) provides the answer, I would say.
