I’m writing a simple flask app to be displayed on an Android tablet. How can I restrict connections to only this device? The idea is that only whoever has said tablet in his/her hands can post to the server, no login required.
I don’t think it is possible to write a flask app that can read the serial number or unique identifier of a piece of hardware. (That seems like it would be a major security risk.)
However, you can write an app that requires authentication using a service such as Duo Mobile and then register the tablet as the device that receives the Duo Mobile push. (There is a Duo library for Python.)
Alternatively, you could restrict the flask app to a single IP address and set a static IP address for your device. This would have a very similar effect.