1

After upgrading Dotnet core framework from 1.0 to 2.1 the AWS Cognito calls are failing to give a Signature mismatch error. The same calls if connected with the old framework (1.0) code is still working.

Like the following call:

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;

is throwing the following error:

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. (The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.) Source=System.Private.CoreLib StackTrace: at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at WDP.Services.UserService.ListUsersInGroupAsync(String groupName) in C:\Users\arupc\source\WDP\Projects\WDP\WDP.Services\UserService.cs:line 631 at WDP.Services.UserService.GetUsers(User loggedUser) in C:\Users\arupc\source\WDP\Projects\WDP\WDP.Services\UserService.cs:line 194 at WDP.Lambda.Controllers.UserController.GetAllUsers() in C:\Users\arupc\source\WDP\Projects\WDP\WDP.AWSServerless\Controllers\UserController.cs:line 58 at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()

This exception was originally thrown at this call stack: 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)

Inner Exception 1: AmazonCognitoIdentityProviderException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

Inner Exception 2: HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.

Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
Arup Chaudhury
  • 169
  • 3
  • 18
  • Does this answer your question? [AWS S3 - How to fix 'The request signature we calculated does not match the signature' error?](https://stackoverflow.com/questions/30518899/aws-s3-how-to-fix-the-request-signature-we-calculated-does-not-match-the-sign) – Roman Marusyk Jan 29 '20 at 13:17
  • No, the error that I am getting is caused by incompatible dlls. – Arup Chaudhury Jan 30 '20 at 06:31

1 Answers1

0

The signature mismatch issue that I was getting was caused by the following issue:

"Amazon.Lambda.DynamoDBEvents" Version="1.1.0" dll was not compatible with "AWSSDK.CognitoIdentityProvider" Version="3.3.4" dll or above.

And the solution is to downgrade the Amazon.Lambda.DynamoDBEvents version from 1.1.0 to 1.0.0.

Arup Chaudhury
  • 169
  • 3
  • 18