GitLab Resource owner password credentials flow is returning 404

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__(
        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 ="{self.base_url}/oauth/token", data=data, auth=auth)
        print("response: ", response.json())

But when I run this, I get the following:
response:  {'error': '404 Not Found'}

I do not understand why this is happening. Please help