'How to edit datasource credentials of imported PBIX file - Power BI API?

I have problem with credentials of datasource. I use .NET library PowerBI.API, I´m importing PBIX file, which has connection to Excel file. I have installed On-Premises Data Gateway. When file is imported, I can´t refresh dataset because the credentials are invalid.enter image description here

When I click on Edit credentials, it show this.enter image description here

I click on Sign in and refreshing works fine. But I need make it by API. I tried many ways, but nothing works.

I will be happy for any advice.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source