# Not able to login using notebook\_login()/!huggingface-cli login

**URL:** <https://discuss.huggingface.co/t/not-able-to-login-using-notebook-login-huggingface-cli-login/77746>\
**Category:** Beginners\
**Created:** [March 17, 2024, 9:08am UTC](https://discuss.huggingface.co/t/not-able-to-login-using-notebook-login-huggingface-cli-login/77746 "2024-03-17T09:08:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayush15](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Ayush15](https://discuss.huggingface.co/u/Ayush15)\
**Post date:** [March 17, 2024, 9:08am UTC](https://discuss.huggingface.co/t/not-able-to-login-using-notebook-login-huggingface-cli-login/77746/1 "2024-03-17T09:08:45Z")

</div>

Hi, I am a complete beginner and this was my first attempt to use use the Huggingface products. I tried experimenting with this notebook ([Audio-classification](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb#scrollTo=EC8RjlPrk2X0)). The instructions up top said in clear words ‘_First you have to store your authentication token from the Hugging Face website if you haven’t already!) then execute the following cell and input your username and password:_’ I signed up and created a token and the prompt asked me to enter **Username** & **Password**  
 ![Screenshot 2024-03-17 at 8.02.13 PM](https://us1.discourse-cdn.com/hellohellohello/original/3X/2/1/215187624b60a036f26bef29797eeb0f9fea73c4.png)  
I entered the details and this was the message I got

404 Client Error: Not Found for url: [https://huggingface.co/api/login](https://huggingface.co/api/login)

Error
```
Cannot POST /api/login
```

**I tried entering my token instead of my password**  
**I tried changing my password**  
Same result. Everywhere I go all the forums & tutorials login using a token. Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![dyrutter](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dyrutter](https://discuss.huggingface.co/u/dyrutter)\
**Post date:** [March 17, 2024, 1:11pm UTC](https://discuss.huggingface.co/t/not-able-to-login-using-notebook-login-huggingface-cli-login/77746/2 "2024-03-17T13:11:18Z")

</div>

I’ve found that using login() rather than notebook\_login() works better. The code looks like:  
from huggingface\_hub import login

login(new\_session=False, # Won’t request token if one is already saved on machine  
write\_permission=True, # Requires a token with write permission  
token=‘Your token’, # The name of your token  
add\_to\_git\_credential=True)  
Have a hugging face token ready ahead of time that you can copy and paste into the ‘token’ argument. If you created a token with a write permission, use write\_permission=True. You won’t have to use the cli if you do it this way.

---

<div class="post-metadata">

**Author:** ![edanodongo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/edanodongo/32/30556_2.png) [@edanodongo](https://discuss.huggingface.co/u/edanodongo)\
**Post date:** [August 16, 2024, 10:00am UTC](https://discuss.huggingface.co/t/not-able-to-login-using-notebook-login-huggingface-cli-login/77746/3 "2024-08-16T10:00:08Z")

</div>

You may have specified the wrong space.  
Make sure the access token you are using is for the intended space.
