I can't get the authentication token for the API

The request you’re making is Step 3 of the Auth Code flow, it wont work if you don’t do the steps before it.

If you don’t need any permissions from a user you should use the Client Credentials flow for an App token like that which Barry linked.