从Xamarin嵌入的Power BI

问题描述 投票:1回答:1

我正在通过Xamarin编写的iOS和Android应用程序连接到Power BI Embedded。

我在https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token处处理了“应用拥有数据”的示例,但是,函数UserPasswordCredential无法用于在C#的Xamarin版本中创建AuthenticationContext。

我的问题:从Xamarin连接到Power BI Embedded是受支持的方案。如果是这样,欢迎使用指向文档/示例的指针。

xamarin adal powerbi-embedded
1个回答
0
投票

您可以找到样本here

    public Task<AuthenticationResult> Authenticate(string authority, string resource, string clientId, string returnUri)
    {
        var uri = new Uri(returnUri);
        var authContext = new AuthenticationContext(authority);
        var platformParams = new PlatformParameters(CrossCurrentActivity.Current.Activity);

        if (authContext.TokenCache?.ReadItems()?.Any() is true)
            authContext = new AuthenticationContext(authContext.TokenCache.ReadItems().First().Authority);

        return authContext.AcquireTokenAsync(resource, clientId, uri, platformParams);
    }
© www.soinside.com 2019 - 2024. All rights reserved.