Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

API credentials with gateway error

Hello

I have the following function where I connect to an API but previously request a token

apenaranda_0-1719471862282.png

Later, when I receive the token, I connect to the api with the token to perform the query.

From power bi desktop I have no problem but when I want to update the data from the gateway I get an error "Some credentials have not been validated because they have been set to bypass the test connection" and "The credentials provided for the Web origin are invalid."

Credentials in powerbi desktop are anonymous - none

The gateway is the same but the errors come out and the model does not update.

Could you help me?

6 REPLIES 6
v-jtian-msft
Community Support
Community Support

Hi,@apenaranda  I am glad to help you.
Has your problem been solved? If your problem has been solved, please mark the suggestion to solve the problem as a solution.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

v-jtian-msft
Community Support
Community Support

Hi,@apenaranda I am glad to help you.

Based on your description, it appears that the Power BI service is having issues when it tries to refresh data through the local data gateway using the credentials provided for the web source. The gateway connection fails and the reports on the service cannot be refreshed.
In fact getting data from the web via the API to produce reports is something I would recommend you do using dataflow.
I have discussed your issue with other members of the team. I have discussed your issue with other members of the team and believe that the dataflow you are currently trying to achieve through the Power BI Gateway is not applicable to the way you are getting data from the API.
This is because you need to provide a token for authentication when you get online data through the API, but the problem is that the token is dynamically changing and has a time limit. The gateway connection in power BI does not have the role of sending a token, it can only authenticate through a fixed authentication method that is set up, which means that there is no way to refresh the data through it. there is no good way to get the data through the gateway to refresh the data.
But the good news is that you can use dataflow form to get data, Creating new dataflows through API code, dataflow is a set of packaged data collection, you can directly use this dataflow to get data to create reports. By refreshing the dataflow to get the latest data, you can achieve the same effect as the gateway, instead of using the gateway connection to refresh the data.
Here are some of my suggestions:

vjtianmsft_0-1719550774901.png

vjtianmsft_1-1719550786902.png

Getting web data through APIs to create dataflows

vjtianmsft_2-1719550979398.png

Creating your report from a created dataflow

All you need to do is configure a refresh schedule for your dataflow and you can achieve the same results as if you were using a gateway refresh directly, with the benefit that the dataflow can be unified across multiple different data sources and  is easy to manage.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

Hello

I understand then that I should put my function that I had in this new flow as it is?

What I haven't mentioned before is that I use the following to bring (in this case they are states) in the form of a table connecting to the api (already with the token)

apenaranda_0-1719553587209.png

Where should I put the API call?

Hi,@apenaranda. I am glad to help you.
You need to copy what you have in your power query into it

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

To sum up, let's see if I'm doing it right.

1. The functions, both the one that requests the token and the one that connects to the API, I remove from Power BI Desktop

2. I create a dataflow for each of them, the one that asks for the token and the one that connects to the api

Is that so?

Hi,@apenaranda I am glad to help you.
You just need to copy all the data source queries you executed in the power query into the blank query of the dataflow, and if you have multiple query steps you need to save them in a dataflow, making sure to keep them the same as in the power query, because the dataflow can be seen as another powerquery.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.