2

I am working on a Python script that access Github using basic authentication. I want to use OAuth so that user doesn't have to enter credentials every time he uses the script. Most importantly, user's password does not get saved in the .bash_history.

This Github API has the code to get token using Basic authentication.

`curl -u $USER_NAME --silent https://api.github.com/authorizations`

User is asked to enter password and gets token in the response.

  1. Now where do I save this token securely so that next time when the script is run user doesn't have to enter anything?
  2. The aim is to avoid storing the password or asking the user to enter every time he uses the script. Is there some other way to achieve these?

1 Answer 1

4

You should probably save the token in a config file in the user's home directory. Preferably, you can restrict permissions on the file to make sure that only that user may access the config file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.