'React Native Expo: How to protect secret keys like Google Maps key?
We can't store the secret keys in the app code as they can be easily extracted by hackers.
One way is to get them from a backend service but my app works without authentication (guest user), so anyone with the backend url can get the keys which is not safe.
Another way is to use Attestation libraries but they need the app to be ejected to bare workflow. I want the solution in Expo managed workflow.
Any suggestions are welcome.
Solution 1:[1]
Google Cloud (Google map in your case) provide various restriction options for both mobile apps and website with package name or website.
You can restrict apps that can use an API key.
https://developers.google.com/maps/api-security-best-practices#application-restriction
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | BYIRINGIRO Emmanuel |