Python Forum
Best way to secure API key when sharing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to secure API key when sharing
#1
Hello I have a script that has an api key in it in plain text. This has been okay because only myself and 1 other person uses it. I have been asked to share it though. With that I need to hide the api key and secret. What is the best method of doing this so I can share the script with others? The ways I have found are below. None of these really seem like good ways to me though besides the encrypted file. I can not figure out how to get an encryption key though. Any suggestions would be appreciated. Thank you.

1. Use an encrypted file
2. Use environment variables
3. Code Obfuscation
Reply
#2
Why don't you simply replace the key/secret with something like <key> <secret> and explain that the user needs to insert their own there?
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply
#3
You could make an executable.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How secure is the use of "secret" import? ejwjohn 12 1,262 Nov-09-2023, 08:31 AM
Last Post: ejwjohn
  How to install modules for 2.7 (or sharing from 3.8)) Persisto 2 2,455 Dec-31-2021, 02:33 PM
Last Post: Persisto
  multiprocessing and sharing object cyrduf 0 2,057 Feb-02-2021, 08:16 PM
Last Post: cyrduf
  sharing variables between two processes Kiyoshi767 1 1,877 Nov-07-2020, 04:00 AM
Last Post: ndc85430
  Sharing my code emirasal 2 2,048 Oct-04-2020, 02:21 PM
Last Post: emirasal
  Sharing X Axis in Sub plots JoeDainton123 1 2,189 Aug-22-2020, 04:11 AM
Last Post: deanhystad
  Extract Httponly, Secure, domain and path from a cookie randeniyamohan 0 1,679 Jan-26-2020, 04:59 PM
Last Post: randeniyamohan
  Secure App Data Storage for Kivy Android App JonPC 1 2,445 Nov-08-2019, 03:42 PM
Last Post: luke
  Instances sharing attributes midarq 4 2,493 Sep-20-2019, 11:13 AM
Last Post: midarq
  Sharing variables across modules j.crater 4 3,459 Jul-30-2018, 09:09 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020