When I test with Postman authenticating at an API site, I get a return token
(which I need) fine. When I try in AS3, regardless of the permutation I try,
it returns the html of the page one would see if they went to the post URL
in a browser.

One of the many permutations I've tried is:

var loginJSON : String;
loginObject = new Object();
loginObject.username = "x...@xxxxx.com";
loginObject.password = "yyyyyyyyy";
loginJSON = JSON.stringify( loginObject );

var loader : URLLoader = new URLLoader();
loader.addEventListener( "complete", onLoginComplete, false, 0, true );
loader.addEventListener( "ioError", onIOError, false, 0, true );

var request : URLRequest = new URLRequest();
request.method = URLRequestMethod.POST;
request.contentType = "application/json";
request.url = "https://xxx.xxxxxxx.com/api/access-token/";;
request.data = loginJSON;

// Following taken out on this attempt
// var header : URLRequestHeader = new URLRequestHeader( "Content-Type",
"application/json" );
// request.requestHeaders.push( header );

try {
        loader.load( request );
} catch ( e : Error ) {
        Alert.show( "There was a problem communicating with LeagueLobster. Error
message: " + e.name + " Code: " + e.errorID + " " + e.message );
}

Does the server need to have a crossdomain.xml file or am I missing
something else that's obvious to more experienced programmers?

Thanks much



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Reply via email to