I am writing a console POC to demo AWS cognito authentication - App Pool not federated identity, as our API gateway authentication mechanism (not hosted in AWS). This is being written in C#.
I have successfully created a user, confirmed them; but now I need to authenticate to retrieve a JWT that an I can pass around and validate downstream.
The following code
using (var client = new AmazonCognitoIdentityProviderClient())
{
var initAuthRequest = new InitiateAuthRequest();
initAuthRequest.AuthParameters.Add("USERNAME", username);
initAuthRequest.AuthParameters.Add("PASSWORD", password);
initAuthRequest.ClientId = clientId;
initAuthRequest.AuthFlow = AuthFlowType.USER_SRP_AUTH;
var response = client.InitiateAuth(initAuthRequest);
WriteLine("auth ok");
}
Yields this exception:
An unhandled exception of type 'Amazon.CognitoIdentityProvider.Model.InvalidParameterException' occurred in AWSSDK.Core.dll
Additional information: Missing required parameter SRP_A
I cannot find a way in the dotnet sdk of generating an SRP header, can anyone help?
Thanks KH