I am working on FreshDesk based client apps,
Facts and my problem:
- FreshDesk widgets/apps only allow jQuery/JS and HTML, doesn't give any server side support yet for developers.
- I am looking get list of Power BI reports in the widget.
- This requires Azure AD Oauth Token, thus I am having trouble making a CORS request.
I some how asked freshdesk to whitelist the domains required for microsoft domain's oauth request calls.
I still get the following error
XMLHttpRequest cannot load https://login.microsoftonline.com/common/oauth2/authorize?. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxxx.freshdesk.com' is therefore not allowed access.
My code is as below
jQuery.ajax({
type: 'GET',
url: authorizeURL,
headers: headers1,
beforeSend: function(xhr){xhr.setRequestHeader('Access-Control-Allow-Origin','https://login.microsoftonline.com');},
success : function(text1)
{console.log(text1);}
});