Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Vinny Harris-Riviello
Vinny Harris-Riviello
11,898 Points

Where to store API keys for iOS app

Hi in the Weather App we created, we had an API key and secret to use to access the API. For the lecture we just used private, but Prasan mentioned that in real that would probably not be enough and he would do something different. Does anyone have some ideas on how to protect API keys on real life scenarios.


1 Answer

There is no perfect solution to this. If the hacker is good, he/she will eventually find it out no matter what you do. There are ways to prevent that further by obfuscating the key using hashes and such. In real-life, if you're on a team, my suggestion would be to plan that with the backend guys. I'm sure they'll know a ton about security.