I am following this documentation: https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAC/DeterminingBaseURL.html
Using basic authentication.
I have already determined the base URL, so I am using the base URL directly in the code.
I am not 100% if i need authorization code or not (not sure, how i will get it) so i am not using this in my code: https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAC/Authentication_Basic.html
I am trying to get a list of emails by a simple GET request like here: https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAC/api-application-2.0-emails.html
So far, I have created this code but I do not see any success? why? is there any issue with my code? can anyone help please?
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var username = "MYUSERNAME";
var password = "MYPASSWORD";
function make_base_auth(user, password) {
var tok = user + ':' + password;
var hash = btoa(tok);
return "Basic " + hash;
}
var url1 = 'https://BASEURL.com/api/REST/2.0/assets/emails';
$.ajax
({
type: "GET",
url: url1,
dataType: 'jsonp',
cache: false,
//contentType: 'application/x-www-form-urlencoded',
headers: {
'Accept': 'text/html',
'Content-Type': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Access-Control-Allow-Origin': '* ',
'Access-Control - Allow - Headers': 'Origin, X-Requested - With, Content-Type, Accept'
},
//async: false,
//data: '{}',
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', make_base_auth(username, password));
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus, errorThrown);
console.log(errorThrown);
},
success: function (result) {
console.log(result);
alert('success - this is working');
}
//success: function (jsondata) {
// console.log(status);
//}
});
});
</script>
</head>
<body>
</body>
</html>
I am getting CORP error in the log. Based on the documentation that I have provided, do I need to pass 'Authorization' in the header? If yes, how can i get the authorization code?
How to report the CORP error?
The alert box only says "error".


failanddoneto see what goes wrong? You can also check the browser console.