I am trying to use OAuth authentication to get the Salesforce Authentication Token, so I referred wiki docs, but after getting authorization code, when I make a Post request
I tried many solutions above which did not work for me. However the trick that actually worked for me was to stop using curl and to use postman application to make the request instead.
By replicating the request in postman, with a POST request and the following params
This solved the issue for me.
Just posting it here in case there are others who have tried all the possible solutions with no avail (like I did).