I am working on an android app for IoT devices. The android app takes the data from IoT device and sends to NodeJS which stores in MongoDB. I am using the AES-256 encryption to send the encrypted data to NodeJS server using POST request. Now, the problem is anyone can create this POST request and store some data into the mongodb. To protect that we can use JWT, but the problem is that this app won't have any username and password facility. So, I was thinking of sending some kind of token which will validate in the server side and once it is validated it will store the data. But I cannot understand on how to generate this token and save this from MITM attack.
I cannot use session as it is against philosophy of IoT. Any other idea would be great. Also, I was thinking of using EJBCA for implementing PKI, however I have little knowledge onto that. A small light on that would be great too.
My setup is running in localhost.