How to check if device exists when using tenant API token

The issue was raised before in GRPC StatusCode "Unauthenticated" when trying to delete nonexistant device.

Author of the original issue was able to workaround his case by switching to global api keyas instead of tenant keys.

@brocaar also notes that

ChirpStack will first check if you have access to the device

My question is:

  • How can I distinguish if device does not exist, or I have no access to it (it is needed for internal purposes of upsert operation) when using tenant api key? (please don’t suggest using global api key)