I'm trying to use an Angular $http POST call to an OAuth token service, and I'm having trouble getting the data format correct.
Right now I'm using the following to paramaterize a simple object, like so:
$.param({
        grant_type: "password",
        username: 'myusername',
        password: 'mypassword'
    })
This produces: grant_type=password&username=myusername&password=mypassword
This output is correct. I need this string, without quotes, to be sent to the server.
I'm using:
$http({
        method: 'POST',
        url: '/services/token',
        data: $.param({
            grant_type: "password",
            username: 'myusername',
            password: 'mypassword'
        }),
        headers: {
            'Content-type': 'application/x-www-form-urlencoded'
        }
    }).success(function(data) {
        $window.alert(data.access_token);
    }).error(function(data) {
        $window.alert('failed');
    });
This produces 400 error on the server because the data sent is: "grant_type=password&username=myusername&password=mypassword" (with quotes)
How can I remove the quotes?
 
     
    