The token endpoint is a secured URL. You need to authenticate using the standard mechanism (Authorization header, or PKI cert) as well as providing the username/password in the body.
From memory, the REST authentication does not need to match the username in the body.
It sounds like you don't want to use the token service at all.
The token service is for a very specific use case - if you're just trying to setup authentication to Elasticsearch, then it's not what you need.
If you have a username and password, then you just want to configure your HTTP client to do "Basic authentication". The specifics for that depend entirely on what client you are using to connect to ES.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.