SyntaxFix
Write A Post
Hire A Developer
Questions
I think that the body isn't correct for an application/x-www-form-urlencoded content type. You could try to use this:
application/x-www-form-urlencoded
var body = 'username=myusername&password=mypassword';
Hope it helps you, Thierry