cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Digger
Helper V
Helper V

OAUTH API anonymous domain return 301

I have a power query with a REST api call:

 

 authKey = "Bearer blablablaKey",
 url = "https://app.fleethand.com/oauth/token",

 GetJsonQuery = Web.Contents(url,
     [
         Headers = [#"Authorization"=authKey, #"Content-Type"="application/json"]
     ]
 ),
FormatAsJsonQuery = Json.Document(GetJsonQuery),

So, this power query use "Anonymous" authentication. When i refresh this query in Power BI Desktop appears credentials error, but if you accept the power query is executed and everything is ok.

 

PBI check if any of domain path return 200 response code, but how to bypass this checking? As my domain return redirect 301 or 401

so PBI cant proof domain page

1 ACCEPTED SOLUTION
v-polly-msft
Community Support
Community Support

Hi @Digger ,

This is not possible due to constraints with the way Web.Contents stores credentials. They are stored based upon the URL value passed, and there can only be one URL per Dataset. In this case, you're trying to short-circuit a typical oAuth2 flow (one URL) and call the API (another URL). When we made an attempt at using RelativePath to 'trick' the service, but stills require that the root of those two endpoints returned a valid HTTP 200 response to indicate connection success. In this case, https://www.googleapis.com returns a 404.

 

The only workaround for us so far, is to execute the query elsewhere and connect PBI to that as a data source.

 

I have also found a similar post, please refer to you to see if it helps you.

Attempt to get list of Workspaces via REST API results in 401 Unauthorized. 

  • By going to your App Registration and clicking on API Permissions and then clicking on any of the API permissions you've added. This will bring up a window which shows the URL for that API Permission.

 

If it does not help, please provide more details. 

Will this error be reported when you log in with a different authentication? Can you refresh it in the Power

Query?  What are the specific errors? Could you please provide a screenshot with the error.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

1 REPLY 1
v-polly-msft
Community Support
Community Support

Hi @Digger ,

This is not possible due to constraints with the way Web.Contents stores credentials. They are stored based upon the URL value passed, and there can only be one URL per Dataset. In this case, you're trying to short-circuit a typical oAuth2 flow (one URL) and call the API (another URL). When we made an attempt at using RelativePath to 'trick' the service, but stills require that the root of those two endpoints returned a valid HTTP 200 response to indicate connection success. In this case, https://www.googleapis.com returns a 404.

 

The only workaround for us so far, is to execute the query elsewhere and connect PBI to that as a data source.

 

I have also found a similar post, please refer to you to see if it helps you.

Attempt to get list of Workspaces via REST API results in 401 Unauthorized. 

  • By going to your App Registration and clicking on API Permissions and then clicking on any of the API permissions you've added. This will bring up a window which shows the URL for that API Permission.

 

If it does not help, please provide more details. 

Will this error be reported when you log in with a different authentication? Can you refresh it in the Power

Query?  What are the specific errors? Could you please provide a screenshot with the error.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Helpful resources

Announcements
Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.