I have a PHP Oauth2 server requiring for the password grant client_id, client_secret, username, password. It works fine if I send the request in POST as
{"grant_type": "password", "client_id" : "xxx", "client_secret" : "yyy", "username" : "www", "password" : "zzz"}
Now I was looking to implement Basic Auth setting the headers. If I move the username and password setting the header to, in my POST request
headers.Authorization = 'Basic '+btoa("www:zzz");
But then the response I get is invalid_client
My question is, what would be the correct headers for this type of grant?