CORS Oauth Request in JQuery to Azure AD to Access Power BI api -
i working on freshdesk based client apps,
facts , problem:
- freshdesk widgets/apps allow jquery/js , html, doesn't give server side support yet developers.
- i looking list of power bi reports in widget.
- this requires azure ad oauth token, having trouble making cors request.
i how asked freshdesk whitelist domains required microsoft domain's oauth request calls.
i still following error
xmlhttprequest cannot load https://login.microsoftonline.com/common/oauth2/authorize?. response preflight request doesn't pass access control check: no 'access-control-allow-origin' header present on requested resource. origin 'https://xxxx.freshdesk.com' therefore not allowed access.
my code 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);} });
freshdesk supports oauth in different way.
provide following in oauth_config.yaml
client_id: "5exxxxxx-xxxx-xxxx-xxxx-xxxxxxxxc8d1" client_secret: "q8nbxxxxxxxxxxxxxxxx1p1" authorize_url: "https://login.domain.com/authorize" token_url: "https://login.domain.com/token" options: scope: "read" token_type: "account"
more information available @ https://developers.freshdesk.com/docs/oauth/
Comments
Post a Comment