Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Jet Call Authenticated ADF Rest Using Ajax CORS ERROR

I have two applications
1- ADF BC Rest Services Application and ADF Security is applied,
2- Oracle JET Application
I have called a login service from adf app using username and password and it returns JSESSIONID, which i saved on cookie to use it again to call rest services without username and password.
i used this ajax call on the second call :
$.ajax({
type: "GET",
url: "http://127.0.0.1:7101/hr/rest/v0/Employees",
contentType: "application/vnd.oracle.adf.resourceitem+json",
crossDomain: true,
headers: {
"Cookie": "JSESSIONID=" + app.getCookie("SID"),
},
success: function (data) {
console.log(JSON.stringify(data));
},
error: function (xhr, textStatus, errorThrown) {
console.log(errorThrown);
},
});

But it returns these errors:
Refused to set unsafe header "Cookie"
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
I have enabling cors on adf web.xml.
So i Don't know how to solve this.
I just need to know how call authenticated rest using jsessionid ?
Thanks

Comments

Christian.Shay -Oracle
Answer

Hi Bob,
When I have seen something this extreme, usually something went wrong in the installation and it needs to be reinstalled.
What version of our extension are they using?
What OS and version are they using?
What version of the .NET Runtime are they using?
Lets try to reinstall, and lets wait after each step to give it a chance to complete and open and close VS Code with each step:
Uninstall the extension, wait 2 minutes, restart VS Code, wait 2 more minutes, reinstall of the extension, wait 2 minutes, and then restart vscode.
Let me know if this fixes it for them.

Marked as Answer by BobMilli · Apr 28 2022
BobMilli

Hello,
Thanks for your help.
It was due, as you suspected, as a missing correct .NET Runtime.
Issue fixed !
Regards,
Bob

Christian.Shay -Oracle

Hi Bob,
We are supposed to prompt the user if they don't have the correct .NET Runtime installed and we offer to take them to a web page to show them how to install it.
Did that happen in this case? If not, that is a serious issue and I would appreciate it if you could let me know what versions of .NET Runtime they had installed on their machine when this failure occurred. If we did notify them about the missing .NET Runtime, but they ignored it, then this is expected behavior.

1 - 3

Post Details

Added on Apr 24 2021
1 comment
337 views