How to generate Device JWT token for hosted mender virtual device

I am trying to generate device jwt token from https://hosted.mender.io/api/devices/v1/authentication/auth_requests this api but everytime is says signature verification failed. Can someone please guide on this?

Hi @mender111 ,

First and foremost, which kind of public key are you using? Are you setting the X-MEN-Signature field in the header accordingly? If in doubt, you could for example drop your public key generation command here to cross check.

Greetz,
Josef

Hi @TheYoctoJester, I am using hosted mender as of now. Also I have created one virtual device there. So the public key I have received from there that I am using now. How can I get a X-MEN-Signature for that?

Thx,
Vinay

Hi @mender111,

It sounds like there are some misunderstandings on which key is involved in which way here. So, the public key which is mandatory in the request body is a per-device unique key. So you have to create it yourself, and you can choose the algorithm amongst RSA, ECDSA and ED25519. The algorithm you chose goes into the X-MEN-Signature field of the header.

The tenant token you can obtain from the web interface goes into the tenant_token field of the request body (see also the body format documentation). If you are using the Hosted Mender instance, then it is mandatory because it will be used to map the device to your account.

Greetz,
Josef