Problem with Hugging Face OAuth API


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:
with the access_token obtained from the post request to
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?

same problem

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.