I want to get an Access token of my registered application on azure. To do so I wrote a piece of code to hit the rest-API.
This is my code:
<html>
<head>
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://secure.aadcdn.microsoftonline-p.com/lib/1.0.12/js/adal.min.js"></script>
<script src="/static/powerbi.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div id="captionArea">
<h1>Power BI Embed test</h1>
</div>
<div id="embedContainer" style="height:500px">
</div>
<script> (function () {
var reportId = 'cbd6b049-8c11-4fca-a4ac-762317b5bc54'
var groupId = 'e6670d37-8784-400b-8c8d-57a5dc023b60' //workspace_id
var datasetId = 'dc07c338-a9d3-4cfb-ac98-8daf40706dc8'
var settings = {
"url": "https://login.microsoftonline.com/041ba837-1928-46ad-98e6-a87e0c0b4b41/oauth2/token",
"method": "POST",
"crossDomain": true,
"dataType": 'jsonp',
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": {
"client_id": "6b7f8e3c-0551-4ac9-b9eb-b1dd34e5817c",
"username": "Pbiembed@scopeworker1.onmicrosoft.com",
"password": "pbiMusa0775",
"grant_type": "password",
"resource": "https://analysis.windows.net/powerbi/api"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
}());
</script>
</body>
</html>
and after this, I got a response. In the console, under the header section I got status: 200 and request method: GET but in my code, the request method is "POST", and In the response section it shows "This request has no response data available" :
I don't know, why I am not getting any response and how my request method changes from "POST" to "GET"?
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.
User | Count |
---|---|
3 | |
3 | |
2 | |
2 | |
1 |
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
2 |