首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Microsoft.Identity.Web请求图形权限时出错

通过Microsoft.Identity.Web请求图形权限时出错
EN

Stack Overflow用户
提问于 2020-03-07 02:17:32
回答 1查看 544关注 0票数 0

在我的基于WebApp-graph-user sample的应用程序中,我得到了以下错误堆栈。我只是尝试登录并获取User.ReadBasic.All图形权限的令牌。我检查了所有进入AcquireTokenByAuthorizationCode的参数,它看起来都很好(没有空值)。App是使用.net core 3.1的MVC应用程序。

堆栈:

NullReferenceException:对象引用未设置为对象的实例。Microsoft.Identity.Client.Internal.ClientCredentialWrapper.get_Thumbprint() Microsoft.Identity.Client.Internal.JsonWebToken+JWTHeaderWithCertificate..ctor(ClientCredentialWrapper凭证,布尔凭证) Microsoft.Identity.Client.Internal.JsonWebToken.EncodeHeaderToJson(ClientCredentialWrapper凭证,布尔凭证) Microsoft.Identity.Client.Internal.JsonWebToken.Encode(ClientCredentialWrapper凭证,布尔凭证) Microsoft.Identity.Client.Internal.JsonWebToken.Sign(ClientCredentialWrapper凭证,布尔记录器,Microsoft.Identity.Client.Internal.Requests.ClientCredentialHelper.CreateClientCredentialBodyParameters(ICoreLogger sendCertificate,ICryptographyManager cryptographyManager,ClientCredentialWrapper clientCredential,string clientId,AuthorityEndpoints sendCertificate,bool sendX5C) Microsoft.Identity.Client.Internal.Requests.RequestBase.SendTokenRequestAsync(string tokenEndpointOverride,sendX5C additionalBodyParameters,string scopeOverride,string tokenEndpointOverride,CancellationToken cancellationToken) Microsoft.Identity.Client.ApiConfig.Executors.ConfidentialClientExecutor.ExecuteAsync(AcquireTokenCommonParameters IDictionary,string additionalBodyParameters,CancellationToken cancellationToken) tokenEndpointOverride cancellationToken) bool cancellationToken) Microsoft.Identity.Client.ApiConfig.Executors.ConfidentialClientExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters,,) context,结果作用域)中的值+变量Microsoft.Identity.Web.WebAppServiceCollectionExtensions+<>c__DisplayClass2_1+d.MoveNext() =等待应用程序中的结果+等待tokenAcquisition.AddAccountToCacheFromAuthorizationCodeAsync(context,options.Scope).ConfigureAwait(假);Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RunAuthorizationCodeReceivedEventAsync(OpenIdConnectMessage authorizationResponse,ClaimsPrincipal用户,AuthenticationProperties属性,JwtSecurityToken jwt) Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()

代码:来自TokenAcquisition.cs -第127行

代码语言:javascript
复制
                // Do not share the access token with ASP.NET Core otherwise ASP.NET will cache it and will not send the OAuth 2.0 request in
                // case a further call to AcquireTokenByAuthorizationCodeAsync in the future is required for incremental consent (getting a code requesting more scopes)
                // Share the ID Token though
                var result = await application
                    .AcquireTokenByAuthorizationCode(scopes.Except(_scopesRequestedByMsal), context.ProtocolMessage.Code)
                    .ExecuteAsync()
                    .ConfigureAwait(false);
                context.HandleCodeRedemption(null, result.IdToken);
EN

回答 1

Stack Overflow用户

发布于 2020-03-07 06:16:27

已解决:由于这里讨论的错误配置,这被证明是一个空的客户端密码值:https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/1476

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60569602

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档