我尝试了3种没有结果的方法:
var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
var result = context.AcquireToken("https://management.core.windows.net/", clientId, new Uri(redirectUri));Run Code Online (Sandbox Code Playgroud)
,但它失败,但例外:
Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException was unhandled
Message: An unhandled exception of type 'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException' occurred in Microsoft.IdentityModel.Clients.ActiveDirectory.dll
Additional information: AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.
Trace ID: aa2d6962-5aea-4f8e-bed4-9e83c7631887
Correlation ID: f7f1a61e-1720-4243-96fa-cff182150931
Run Code Online (Sandbox Code Playgroud)
var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
var result = context.AcquireToken("https://management.core.windows.net/", new ClientCredential(clientId, clientSecret));Run Code Online (Sandbox Code Playgroud)
其中clientSecret是我的应用程序的秘密应用程序密钥.此版本返回一个令牌,但使用此令牌的请求将返回403 Forbidden:服务器无法验证请求.验证证书是否有效并与此订阅相关联.
var context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenantId));
// …Run Code Online (Sandbox Code Playgroud) c# authentication azure azure-active-directory azure-management-api
从 DocumentDB 请求文档时,我偶尔会遇到 UnauthorizedException。该问题与Azure DocumentDB类似- HTTP 请求中发现的 MAC 签名与计算出的签名不同,因此我认为该问题没有解决。
Microsoft.Azure.Documents.UnauthorizedException :
Message: "The MAC signature found in the HTTP request is not the same as the computed signature.
Request URI: rntbd://db5prdddc01-docdb-1.documents.azure.com:14245/apps/35e0fabb-e03e-48d4-90ad-7b91b63c0153/services/9bb95f7b-9ad6-4128-a66a-de68279d5124/partitions/44a24d42-a85c-42cc-98c4-fc8a733245ac/replicas/130953283548138839p/
Run Code Online (Sandbox Code Playgroud)
更新:问题已修复,特别感谢 Andrew Liu!
我想使用 Xamarin Forms 将图像列表显示为具有多行(2 或 4)的网格。网格的每个单元格必须是正方形的。我在 DataTemplate 中使用具有垂直布局、所需跨度和固定 HeightRequest 的 CollectionView。我得到多列网格,但我无法使图像(单元格)平方。
<CollectionView ItemsSource="{Binding .}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="2" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Image
HeightRequest="100"
x:Name="imageCell"
Aspect="AspectFill"
Source="{Binding .}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
Run Code Online (Sandbox Code Playgroud)