![](/img/trans.png)
[英]Is it possible to sign in to my website and use the e-mail and password to authenticate on power bi?
[英]Power BI - Programmatically sign in
我正在嘗試編寫一個嵌入了一些 Power BI 報告的 Web 應用程序。 數據在本地,因此我無法使用可用的新解決方案(Power BI Embedded)。 現在使用舊方法( https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-a-power-bi-tile-or-report/ )的不便在於web 頁面需要是 Power BI 用戶,該用戶需要登錄才能讓 Web 應用最終獲得身份驗證令牌(之前需要進行幾次頁面重定向)。 所以我的問題是,有沒有辦法以編程方式進行 Power BI 登錄? 這樣我就可以只使用一個 Power BI 帳戶來獲取內容。
我也在那里進行實驗,這個線程幫助我解決了這個問題(見帖子 #8):
基本上:
POST 請求到: https : //login.microsoftonline.com/common/oauth2/token
正文,表單 url 編碼:
然后你直接得到令牌。
此外,考慮如下所述的安全問題可能會很好: http : //www.cloudidentity.com/blog/2014/07/08/using-adal-net-to-authenticate-users-via-usernamepassword/在“When不要使用此功能”
我也在做同樣的事情,這只是巧合。 實際上,Power BI 提供了一個 Rest API 來很容易地做到這一點。 您需要在 Azure 門戶注冊一個應用程序,該應用程序將為您提供客戶端 ID 和客戶端機密。 現在您可以使用其余 API 和這些詳細信息。
POST: https://login.microsoftonline.com/common/oauth2/token
在正文中,您需要發送這些詳細信息,在標題中,您需要設置Content type : application/x-www-form-urlencoded
data: {
grant_type: password
scope: openid
resource: https://analysis.windows.net/powerbi/api
client_id: {Client ID}
username: {PBI Account Username}
password: {PBI Account Username}
client_secret: {Enter client secret here}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.