Thank you for your question.
Your code is missing some prerequisite steps needed to register the user pool. I have attached a document that shows the step by step on how to register and authenticate with Cognito user pools. I have also included a document that contains code examples.
Deny request in Cognito Pre Authentication lambda using dot net coreasked 3 years ago
Amazon Cognito: how to change the Endpoint in AWS SDK .NET?Accepted Answerasked 2 months ago
External User creation in Cognitoasked 3 months ago
How to prevent Cognito sign up from exposing user email existence?asked 9 months ago
AWS Cognito - .NET Frameworkasked 3 months ago
Cognito .net framework - federate azure adasked 17 days ago
AWS Amplify AppSync Cognito User Poolasked 6 months ago
How can I get MAU's for a Cognito user pool?asked a month ago
Serverless Authentication Next.JS/Amplify/Cognito - customization of sign up/sign in dialogasked a month ago
Change Sign-up link of cognito to Custom URLasked 6 months ago