Correct way of storing API Keys in flutter following best practises

前端 未结 4 1205
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-23 14:36

Which is the correct way(best practice) of adding secret API keys in flutter in case I want to push the code on github. I\'ve made a simple app that consumes an API b

4条回答
  •  长情又很酷
    2020-12-23 15:07

    As mentioned, if the key is a secrete and you would like to protect it then simply do not put it in the client app. The app can be de-compiled and the key can be extracted for person willing to target your client.

    I would delegate the task of communicating with this API to your Application Server. You can put the key in your server and have your server communicate with this external API and relay the response to the client.

    Edit: Another approach, which is less secure but more convenient is to obfuscate your code using something like proguard. See this page for flutter instruction on android app: https://flutter.io/android-release/

提交回复
热议问题