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.