[ARCHIVED] login/oauth2/token is not being found?

connor_slagowsk
Community Novice

I am getting an error with my application that is confusing me. The POST call on the app to get the authorization token is not going through and the error is giving me a 404. This is the link that is on the Cancas API OAuth documentation so I'm sure it should work.

Here is the code I am using to send the Http POST request:

var get = <?php echo json_encode($_GET); ?>;
var getCode = get.getCode;
function makeCorsRequest() {
var params = "grant_type=authorization_code"+
"&client_id=25330000000000041"+
"&client_secret=Q--------------------------------------------------------------------------------------------------crj"+
"&redirect_uri=10.50.3.106/certApp.app.php"+
"&code="+ getCode;

// This is a sample server that supports CORS.

var xhr = createCORSRequest('POST', url);
if (!xhr) {
alert('CORS not supported');
return;
}

xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

// Response handlers.
xhr.onload = function() {
var text = xhr.responseText;
var title = getTitle(text);
alert('Response from CORS request to ' + url + ': ' + title);
}

xhr.onerror = function() {
alert('Woops, there was an error making the request.');
}

xhr.send(params);
}

I know that the code is getting to the point that it is sending the request because I am getting the alert box that passes back the URL during the onload. It just doesn't seem to send the post to the tokens page to give me my authorization token.

Any help on this would be appreciated.

Labels (2)
0 Likes