Could not get data from web that uses Azure AD authentication

Copper Contributor

More details please see here: could-not-get-data-from-web.
Any help would be greatly appreciated. Thanks in advance. 

4 Replies

It works perfectly in browser and provides REST APIs that return JSON data.


Can you show the detail about this success implement of RESTful Api?

Can we trouble shooting on it?

@peiyezhu 

As you can see from the documentation here (https://learn.microsoft.com/en-us/power-query/connector-authentication), it reads "When you select Sign-in in Step 2 above, Power Query sends a request to the provided URL endpoint with an authorization header with an empty bearer token. The service is then expected to respond with a 401 response with a WWW-Authenticate header indicating the Microsoft Entra ID authorization URI to use. Power Query can then initiate the OAuth flow against the authorization_uri. Power Query requests a Microsoft Entra ID Resource or Audience value equal to the domain of the URL being requested. This value would be the value you use for your Azure Application ID URL value in your API/service registration."

 

You know, the sign in step was completed successfully. The next step, where power query initiate the OAuth flow against the authorization_uri, should be executed automatically and implicitly, if I understand correctly. But I got the error. It seams that power query for excel got an access token with a wrong audience value from the authorization_uri (https://login.microsoftonline.com/{tenant_id}/oauth2/authorize).

 

I have tried https://login.microsoftonline.com/{tenant_id}/oauth2/authorize?client_id={client_id}&response_type=c... and still got the same error. How to get the right audience then?

Different connectors show different authentication methods. For example, the OData Feed connector in Power BI Desktop and Excel displays the following authentication method dialog box.
https://learn.microsoft.com/en-us/power-query/connector-authentication

This should be different from each websites.

The url (https://learn.microsoft.com/en-us/power-query/connector-authentication) you mentioned did not provide specific information about your login(https://login.microsoftonline.com/%7Btenant_id%7D/oauth2/authorize?client_id=%7Bclient_id%7D&respons...).

e.g.
From this url https://e.anyoupin.cn/EData/{Id}.html
you can get
https://e.anyoupin.cn/EData/1222.html

You should privide specific ID for trouble shooting.
It works perfectly in browser and provides REST APIs that return JSON data.


Can you show the detail about this success implement of RESTful Api?
Can you provide the specific url?


https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=http
As far as I know,you should use MS graph api if you want to access one driver.

@peiyezhu 

The issue was caused by using MS Graph to verify the access token getting from the authorization_uri. It is solved now. Thanks anyway.