AWS Cognito signature mismatch issue after aspnetcore upgrade from 1.0 to 2.1

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.

c#
asp.net-core
.net-core
amazon-cognito
asked on Stack Overflow Jan 29, 2020 by Arup Chaudhury • edited Jan 29, 2020 by Roman Marusyk

1 Answer

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.

answered on Stack Overflow Jan 30, 2020 by Arup Chaudhury

User contributions licensed under CC BY-SA 3.0