Flutter REST API Security

107

Can a user decompile the apk and get rest api key and write into my database by postman or sth like that?

If you don't share your APK which is generated in debug mode, it won't be easy to access your API key. You should always consider building your APK in release mode. And you can obfuscate your APK too.

Share:
107
knnkrt7
Author by

knnkrt7

Updated on December 25, 2022

Comments

  • knnkrt7
    knnkrt7 over 1 year

    I'm using REST API key in my flutter project in lib folder so is there any chance for someone to decompile the apk and see my API key? Is it secured?

    • mousetail
      mousetail over 3 years
      Yes, you should generate a API key for every user of your app
    • knnkrt7
      knnkrt7 over 3 years
      Thank you for answer. Can a user decompile the apk and get rest api key and write into my database by postman or sth like that.
    • mousetail
      mousetail over 3 years
      Even if they couldn't, a user can intercept all web traffic. SSL does not protect you when other apps can read your memory.
    • knnkrt7
      knnkrt7 over 3 years
      So whats the solution to protect my data from all attempts
    • mousetail
      mousetail over 3 years
      You should never give sensitive data to the client. Either have your own API that has authentication and proxies the third party API, or if you cannot give each user their own key to the third party API and limit the permissions.
    • Joy Terence
      Joy Terence over 3 years
      In case of mobile clients, you can save the sensitive data such as token, api_key...in keychain (iOS) or in keystore (android). To achieve this in flutter, have a look at flutter_secure_storage