# Problem with Hugging Face OAuth API

**URL:** <https://discuss.huggingface.co/t/problem-with-hugging-face-oauth-api/68164>\
**Category:** 🤗Hub\
**Created:** [January 6, 2024, 2:42pm UTC](https://discuss.huggingface.co/t/problem-with-hugging-face-oauth-api/68164 "2024-01-06T14:42:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nethris](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nethris/32/22743_2.png) [@nethris](https://discuss.huggingface.co/u/nethris)\
**Post date:** [January 6, 2024, 2:42pm UTC](https://discuss.huggingface.co/t/problem-with-hugging-face-oauth-api/68164/1 "2024-01-06T14:42:22Z")

</div>

Hello,

I am working on a school project where I need to perform authentications with third-party services, and in my case, I am using the Hugging Face service. The OAuth2.0 process is completed successfully, but when I try to make a request to the endpoint: [https://huggingface.co/api/whoami-v2](https://huggingface.co/api/whoami-v2)  
with the access\_token obtained from the post request to [https://huggingface.co/oauth/token](https://huggingface.co/oauth/token)  
I get an error:  
{  
“error”: “Invalid username or password.”  
}  
I have double-checked everything, the token, the parameters, etc., but nothing works; I still get this response. However, when I make exactly the same request with a personal access token generated in the settings of my account, it works correctly. How can I solve this problem?

---

<div class="post-metadata">

**Author:** ![Trace2333](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@Trace2333](https://discuss.huggingface.co/u/Trace2333)\
**Post date:** [June 12, 2024, 3:50am UTC](https://discuss.huggingface.co/t/problem-with-hugging-face-oauth-api/68164/2 "2024-06-12T03:50:29Z")

</div>

same problem

---

<div class="post-metadata">

**Author:** ![Trace2333](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@Trace2333](https://discuss.huggingface.co/u/Trace2333)\
**Post date:** [June 12, 2024, 3:59am UTC](https://discuss.huggingface.co/t/problem-with-hugging-face-oauth-api/68164/3 "2024-06-12T03:59:20Z")

</div>

Please check your HF\_TOKEN environment variables or your .bashrc file. It seems that huggingface-cli whoami perfer to use HF\_TOKEN. I solved by changing HF\_TOKEN to the newest token.
