I am trying to access some GitLab resources via Rest API. I am using the Resource owner password credentials flow
and I wrote a simple class:
class GitLab:
def __init__(
self,
username: str,
password: str,
app_id: str = config.get("GITLAB_APP_ID"),
app_secret: str = config.get("GITLAB_APP_SECRET"),
) -> NoReturn:
self.app_id = app_id
self.username = username
self.base_url = config.get("GITLAB_BASE_URL")
data = {
"password": password,
"grant_type": "password",
"username": self.username,
}
auth = httpx.BasicAuth(self.app_id, app_secret)
response = httpx.post(f"{self.base_url}/oauth/token", data=data, auth=auth)
print(response.url)
print("response: ", response.json())
But when I run this, I get the following:
https://gitlab.com/api/v4/oauth/token
response: {'error': '404 Not Found'}
I do not understand why this is happening. Please help