Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Failed to load response data when tried to get access token from azure using javascript

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:

  <script src=""></script>
  <script src=""></script>
  <script src="/static/powerbi.js"></script>
  <script src=""></script>        
  <div id="captionArea">
    <h1>Power BI Embed test</h1>
  <div id="embedContainer" style="height:500px">
  <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": "",
  "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": "",
    "password": "pbiMusa0775",
    "grant_type": "password",
    "resource": ""

$.ajax(settings).done(function (response) {

 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" :

Screenshot (76).png


Screenshot (77).png

I don't know, why I am not getting any response and how my request method changes from "POST" to "GET"?


Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.