# Protecting API keys in app

**URL:** <https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670>\
**Category:** ionic-v1\
**Created:** [November 14, 2014, 2:54am UTC](https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670 "2014-11-14T02:54:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![appneur](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@appneur](https://forum.ionicframework.com/u/appneur)\
**Post date:** [November 14, 2014, 2:54am UTC](https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670/1 "2014-11-14T02:54:27Z")

</div>

Is we make an android app using Ionic, is there a way the remote user can extract the API key from the app package?

---

<div class="post-metadata">

**Author:** ![nicraboy](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/nicraboy/32/6917_2.png) [@nicraboy](https://forum.ionicframework.com/u/nicraboy)\
**Post date:** [November 14, 2014, 6:15am UTC](https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670/2 "2014-11-14T06:15:16Z")

</div>

API keys should be fine if exposed, but secret keys are a different story.

Any client side app can be decompiled if the user is dedicated enough. Android apps can be decompiled to raw source code with just two commands. Doesn’t matter if they’re native or Ionic.

Be careful what you hard code.

---

<div class="post-metadata">

**Author:** ![edd](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@edd](https://forum.ionicframework.com/u/edd)\
**Post date:** [November 14, 2014, 11:07am UTC](https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670/3 "2014-11-14T11:07:35Z")

</div>

So how do you go about storing/accessing secret keys?

Thanks

---

<div class="post-metadata">

**Author:** ![andrewmcgivery](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/andrewmcgivery/32/65523_2.png) [@andrewmcgivery](https://forum.ionicframework.com/u/andrewmcgivery)\
**Post date:** [November 14, 2014, 1:44pm UTC](https://forum.ionicframework.com/t/protecting-api-keys-in-app/12670/4 "2014-11-14T13:44:42Z")

</div>

To be honest, from the research myself and my team have done on the topic, it’s a problem that hasn’t really been solved, native or hybrid.

On native, the “best practice” is to split the key up into multiple encrypted files and put all the pieces together on runtime… security through obscurity.

But perhaps @max as some better advice. 🙂
