It seems that you are trying to get the token using the Client credentials flow but are making the request using the Authorization code flow.
In the client credentials flow you shall not be required to initiate a connection to the authorization endpoint to get the Authorization code. Instead the call is made to the token url with the client id and client secret and the request is for the access token.
If the client ID and client secret is correct then in response you will get the Access token which can be used to initiate the connection.
Note: The Client authentication is supported by the External Oauth providers such as Azure, Okta etc..