Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I'm developing a custom visual for Power BI, and I'm trying to use the Authentication API (https://learn.microsoft.com/en-us/power-bi/developer/visuals/authentication-api). I wrote this function:
  const authenticate = () => {
    props.host.acquireAADTokenService.acquireAADTokenstatus().then((acquireTokenStatus) => {
      console.log('allowed?', acquireTokenStatus)
      if (acquireTokenStatus === powerbi.PrivilegeStatus.Allowed) {
        props.host.acquireAADTokenService
          .acquireAADToken()
          .then((acquireAADTokenResult: AcquireAADTokenResult) => {
            console.log('access token', acquireAADTokenResult)
            if (acquireAADTokenResult.accessToken) {
              getDatasetInfo(acquireAADTokenResult.accessToken, props.datasetId).then((createdDataset) =>
                setDataset(createdDataset),
              )
            }
          })
      }
    })
  }
It logs `allowed? 0`, meaning the privilege is allowed in the project, and then the accessToken is always null. I enabled the option of obtaining Entra ID tokens (https://learn.microsoft.com/en-us/fabric/admin/organizational-visuals#obtain-microsoft-entra-access-...). I also added the privileges to the project, with the url I configured in my Azure application
{
  "privileges": [
    {
      "name": "WebAccess",
      "essential": true,
      "parameters": ["*"]
    },
    {
      "name": "ExportContent",
      "essential": true
    },
    {
      "name": "AADAuthentication",
      "parameters": ["https://mywebsite.com"]
    }
  ],
I also added permissions in the Azure application and I tried adding localhost as a URI redirect.
From what I understood this should be working. What's missing?
Oh ok, how did you manage to get access token or is their any other alternative?
Use the custom connector. It implements AAD auth.
I am very new to PowerBI and custom visual, would be helpful if you can share an example how custom connectors can be linked to custom visual for authentication, if its not an overhead!!
Sorry, my reply was for Power Query, not for custom visuals.
@rodrigopizarro I am facing same issue while using Power BI Authentication API, did you manage to find a solution?
No, and I actually received a response from Microsoft saying they actually don't enable the same credentials for Power BI and for this API, so as of 6 months ago it was simply not possible.
Oh ok, how did you manage to get access token or is their any other alternative?
You register an app in Azure that asks for the (non-delegated) permissions for whatever API calls you need to do.
I have managed to get the acces token, there were lot of setting to be done.
Now I am trying to acheive a token exchange in backend for https://login.microsoft******,  but I am blocked by the CORS error even though I have added the URL into privilages parameter in capabilities.json file.
I have read CORS limitation , is there a alternate workaround for token exchange? 
Hello, is there a possibility that you remember and can help me with the topic issue (accessToken: null). You said that there were a lot of settings to be done.
But which exactly? I have followed Microsoft documentation multiple times but without results.
I have tried to set permissions (User: ReadAll) as both delegated and application as mentioned in this thread.
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
