What is the best way to hide API Keys?

Asked

Viewed 296 times

0

When you’re sharing a repository and don’t want the person to have access to the key of some API, what’s the best way to hide?

  • 2

    In a version control repository (Git for example)? If so, it’s best that you don’t upload that file and add it to the list of ignored Git files (https://git-scm.com/docs/gitignore).

  • Exactly.. But what if key is used inside the code?

  • If you are SHARING I see no reason to want to hide, but if you want I would follow the @vmartins tip about gitgnore but it would give error in your code since you will be using the API key at runtime. I think this goes from the common sense of the team of developers of this project, if the other devs will not be able to have access just don’t share or each have their own key API

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.