Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Alternative interface for credentials/API token #1869

Open
francois-rozet opened this issue Sep 9, 2024 · 3 comments
Open
Assignees

Comments

@francois-rozet
Copy link

francois-rozet commented Sep 9, 2024

Is your feature request related to a problem? Please describe.

Using a environment variable to provide the API token is not convenient. It is not always possible/desirable to edit config files (~/.bashrc, ~/.bash_profile, ~/.profile, ...) to export the API token. Consequently, I am forced to either

  1. export my API token manually in every new terminal or
  2. add my API token in clear in my scripts, which is a safety hazard.

Describe the solution you'd like

A way to login/save credentials from the CLI, that saves a file somewhere in the user space (~).

Describe alternatives you've considered

None.

Additional context

Currently, the quick guides in a new project show that it is possible to provide your API token in the (Python) code. I think this is not a good idea as beginners will very likely push that code to some repository.

@SiddhantSadangi
Copy link
Member

Hey @francois-rozet 👋

We are exploring more user-friendly methods for passing the API token to scripts. Meanwhile, can you try passing your API token as CLI args? It'll prevent your token from being exposed in the script, and you can use your terminal's history or reverse search to rerun scripts with the same token without exporting it manually.

We would also love to know if you could provide examples of tools that do this better ✅

@SiddhantSadangi SiddhantSadangi added feature request pending Waiting for a response labels Sep 26, 2024
@francois-rozet
Copy link
Author

francois-rozet commented Sep 26, 2024

Hi @SiddhantSadangi

Not every Python program is run from the terminal directly. In particular, on a Slurm cluster we have to write the python command in a shell script and launch it with sbatch. Then, giving the API key as an argument to the Python program means writing it in clear in the shell script.

W&B allows you to login (permanently) from CLI (wandb login) or from Python (from wanb import login).

Hugginface allows you to login (permanently) from CLI (huggingface-cli login) or from Python (from huggingface_hub import login).

In both cases a file containing the credentials is stored in the userspace.

@SiddhantSadangi SiddhantSadangi removed the pending Waiting for a response label Sep 27, 2024
@SiddhantSadangi
Copy link
Member

Thanks for sharing the details 🙌

I'll pass this on to the product team ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants