【问题标题】:AWS Cognito signature mismatch issue after aspnetcore upgrade from 1.0 to 2.1aspnetcore 从 1.0 升级到 2.1 后的 AWS Cognito 签名不匹配问题
【发布时间】:2020-05-14 23:32:17
【问题描述】:

将 Dotnet 核心框架从 1.0 升级到 2.1 后,AWS Cognito 调用未能给出签名不匹配错误。如果与旧框架 (1.0) 代码连接,相同的调用仍然有效。

如下调用:

var request = new ListUsersInGroupRequest();
request.GroupName = groupName;
request.Limit = 60;
request.UserPoolId = _configuration.GetSection(Utility.AWS).GetSection(Utility.AWSUserPoolId).Value;

var output = _cognitoIdentityClient.ListUsersInGroupAsync(request).Result;

抛出以下错误:

System.AggregateException HResult=0x80131500 消息=一个或多个 发生错误。 (我们计算的请求签名不匹配 您提供的签名。检查您的 AWS 秘密访问密钥和 签约方式。有关详细信息,请参阅服务文档。) 源 = System.Private.CoreLib StackTrace:在 System.Threading.Tasks.Task`1.GetResultCore(布尔 waitCompletionNotification)在 WDP.Services.UserService.ListUsersInGroupAsync(字符串组名)在 C:\Users\arupc\source\WDP\Projects\WDP\WDP.Services\UserService.cs:line 631 在 WDP.Services.UserService.GetUsers(用户登录用户)中 C:\Users\arupc\source\WDP\Projects\WDP\WDP.Services\UserService.cs:line 194 在 WDP.Lambda.Controllers.UserController.GetAllUsers() 中 C:\Users\arupc\source\WDP\Projects\WDP\WDP.AWSServerless\Controllers\UserController.cs:line 58 在 Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(对象 目标,对象 [] 参数)在 Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper 映射器,ObjectMethodExecutor 执行器,对象控制器,Object[] 论据)在 Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()

此异常最初是在此调用堆栈中引发的: Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(System.Threading.CancellationToken) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)

内部异常 1:AmazonCognitoIdentityProviderException:请求 我们计算的签名与您提供的签名不匹配。 检查您的 AWS 秘密访问密钥和签名方法。咨询 服务文档了解详情。

内部异常2:HttpErrorResponseException:异常类型 引发了“Amazon.Runtime.Internal.HttpErrorResponseException”。

【问题讨论】:

标签: c# asp.net-core .net-core amazon-cognito


【解决方案1】:

我得到的签名不匹配问题是由以下问题引起的:

“Amazon.Lambda.DynamoDBEvents” Version="1.1.0" dll 与“AWSSDK.CognitoIdentityProvider” Version="3.3.4" dll 或更高版本不兼容。

解决方案是将 Amazon.Lambda.DynamoDBEvents 版本从 1.1.0 降级到 1.0.0。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-23
    • 1970-01-01
    相关资源
    最近更新 更多