How to login to Huggingface Hub with Access Token
Hello and thank you!  I looked up this issue but I keep getting topics about ‘tokenizer’ and did not find anything on using access tokens.I simply want to login to Huggingface HUB using an access token.  I signed up, read the card, accepted its terms by checking the box, setup a conda env, installed huggingface-cli, and then executed huggingface-cli login.  When I try and paste my access token (I have tried both read and write) it gives me the following error:Traceback (most recent call last):
  File "C:\Users\mrlor\anaconda3\envs\ldm\Scripts\huggingface-cli-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 41, in main
    service.run()
  File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 176, in run
    _login(self._api, token=token)
  File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 343, in _login
    token, name = REDACTED_TOKEN._validate_or_retrieve_token(token)
  File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\REDACTED_TOKEN.py", line 691, in _validate_or_retrieve_token
    raise ValueError("Invalid token passed!")
ValueError: Invalid token passed!I have also tried typing in the access token by hand. I have deleted and created new access tokens.  I also have git lfs setup.  I restarted my computer and have updated my conda environment. I am sure this is something silly but I have been trying for hours to login with no avail.  I thank you for your help!
2022-09-04T17:19:13Z
Facing same issue. Any resolution?
2022-09-04T18:58:27Z
No, I have not heard from anyone and still can not login.
2022-09-04T20:38:55Z
For what it’s worth, I’ve been doing it like this in my scripts:pip install huggingface_hub
python -c "from huggingface_hub.REDACTED_TOKEN import HfFolder; HfFolder.save_token('MY_HUGGINGFACE_TOKEN_HERE')"Not sure if it’s as convenient as pasting your token, but it might work.UPDATE: Oh I just realized you are on Windows. I guess my advice might not apply, since I don’t know how to pass code in the command line in Windows. But in general, I guess try using Python to do the login?
2022-09-05T22:15:09Z
I have the same issue, when i enter or paste the string, nothing happens on the coursor, like all my input gets blocked, yes im also on windows:token1138×462 144 KBhoping for help
2022-09-06T17:16:47Z
So what ended up working for me was instead of using Ctrl+V to paste the access token I right-clicked on the command line and it pasted it.  Note that you still won’t see anything on the ‘Token:’ line but it is should be there.  Hope this helps!!
2022-09-07T11:20:45Z
I cant yet. I have the same problem. I right clicked before to verify that it copied it and if it was pasted, then I used huggingface-cli login, Enter, right click on the command line and enter and nothing. It won’t let me write either.
2022-09-07T21:53:13Z
How do you even right click? I can’t right click on anaconda prompt
2022-09-08T04:00:28Z
I wasn’t able to create my token with a username or my name so I tried my email registered to huggingface.  I used the right click to paste function and it worked.  Hope that helps
2022-09-12T12:28:24Z
Even when I paste the token into the command line, it calls the token invalidEDIT: I did it several times in a row and it finally worked, don’t know how.
2022-09-15T09:42:03Z
i just have to come here and say that:run the command prompt as admincopy your token inwait about 5 minutesrun huggingface-cli loginright-click the top bar of the command line window, go to “Edit”, and then Pasteit should work. IF IT DOESN’T WORK, DO IT UNTIL IT DOES.
2022-09-15T16:34:34Z
Thank you all for posting your tricks for logging in!  It seems that using hotkeys to paste in the token DOES NOT work (in Windows) so you will have to resort toright-clicking to paste in your tokenorusing Edit->Paste from the toolbar.  Note again that you will not see the token on the command line and will not see asterixis in its place; it will appear completely invisible but will be submitted after your press enter.
2022-09-17T16:30:34Z
Same issue.  "ValueError: Invalid token passed! in powershell with correct toket right clicked (at top) and pasted in.  I even cleared my token and tried a fresh one…no luck.
2022-09-17T16:33:46Z
Nevermind.  Right click edit paste worked.  You just won’t see any indication you put in the key.  Then press enter.  I was probably pasting multiple times or something stupid as the key input field would not show any change but just blink even with the key put it.  Anyhoo, it works.
2022-09-18T00:07:09Z
In the anaconda prompt, just the act of right-clicking will paste your item. I got mine to work by copying the token, typing: huggingface-cli login into the anaconda prompt, literally just right-clicking on the window, and pressing enter.
2022-09-21T02:30:48Z
Also, another way to go is to go to your “\virtualenv\Lib\site-packages\huggingface_hub\commands” folder and there is a file in there called “user” or “userpy”. Edit the file and go to the area in the middle that looks like the huggingface login. The line should saytoken = getpass ("Token: ")Change this line to saytoken = “this is where your hugging face token goes including the quotation marks”#getpass("Token: ")Screenshot 2022-09-20 184134668×712 36.2 KBsave file then run huggingface-cli login
2022-09-24T04:55:00Z
If you are using anaconda prompt and is having[WinError 2] File Not Foundissue, try to install git first using the following command,conda install -c anaconda git
2022-10-20T09:07:06Z
thanks for this! this worked for me
2022-11-12T01:40:48Z
It looks like pasting the token actually works fine for me. The problem is just that the login screen doesn’t show any visual indication that it does! So, just use whatever way you normally paste text onto your terminal screen on this login screen and hit Enter, and it’ll work. Seems like a very trivial fix on the login screen to at least shows dots in-place once the pasted text is entered.
2023-04-02T20:36:17Z
same for me, this seems to be the problem
No date available
No reply text available