Skip to main content

Power BI

New

Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

Vote (54) Share
Ed Freeman's profile image

Ed Freeman on 08 Oct 2021 14:35:12

We are connecting to our data source using OAuth credentials. Sometimes, Power BI requires us to re-enter our credentials in the Service, when the token has been invalidated for some reason (e.g. change of dataset ownership).

We then update the OAuth credentials via the "Gateways - Update Datasource" API. We provide a valid Bearer Token as per the OAuth update example and everything initially works as expected.

However, obviously the bearer token expires after an hour (the default for most bearer tokens), and the Power BI Service asks us to re-enter our credentials. We then have to run this code every hour (or at least before any refresh) to make sure the credentials don't expire.

This doesn't happen if you update the credentials through the UI - refreshing of the token must be being handled by the Power BI Service behind the scenes. But there is no option to provide a "refresh token" in the above "Update Datasource" API.

Please add support for supplying a refresh token when updating datasource credentials programmatically for an OAuth-authenticated data source.

Comments (6)
Ed Freeman's profile image Profile Picture

on 02 Feb 2025 17:01:27

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

It's 2025... Come on guys... Why does the PBI product team hate automation ? Making every devops guy's life so miserable.. Please make the REST API match the UI/browser functionality on the important stuff...

Ed Freeman's profile image Profile Picture

Tim Schubiger on 18 Jul 2024 06:36:10

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

Oh wow, it has been 3 years already. This is a crucial feature and the fact that it works over via the PBI interface shows that it is not a security issue. Would be great if someone from the product team could comment on this.

Ed Freeman's profile image Profile Picture

Sanjeev bind on 23 Feb 2024 00:09:03

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

Can someone please guide me how you get bearer token to pass to "Gateways - Update Datasource" API?

Ed Freeman's profile image Profile Picture

Sandesh Poudel on 25 Sep 2023 06:26:06

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

We need this feature as well. It is blocking our scenario where the service account needs to take ownership of 100s of powerbi reports.

Ed Freeman's profile image Profile Picture

Fabio Righini on 03 Apr 2023 13:18:24

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

our customer has a scenario that requires refresh token.but i think this should be a fundamental feature of the api, or not?

Ed Freeman's profile image Profile Picture

Peter Gie on 08 Dec 2022 16:52:54

RE: Add support for supplying refresh token for OAuth source in Gateways - Update Datasource API

This is a must!