barney1234
asked on
ASP.NET Core Web Client and AWS Cognito User pool to log in and authenticate web client only using AdminInitiateAuthAsync(request)
ASP.NET Core Web Client (RAZOR) Log In using AWS Cognito user pool and AWS .NET SDK to log in user in asp.net core web client
How to use AWS cognito user pool to authenticate and authorise ASP.NET Core WEb Client and ASP.NET Core Web API.
I already created a AWS Cognito User pool and App CLient.. I followed the below article from AWS
https://aws.amazon.com/blogs/mobile/use-csharp-to-register-and-authenticate-with-amazon-cognito-user-pools/
reached the point
var cognito = new AmazonCognitoIdentityProvi derClient( _region);
//var cognito = new AmazonCognitoIdentityProvi derClient( credential s);
var request = new AdminInitiateAuthRequest
{
UserPoolId = _aWSConfig.PoolID,
ClientId = _clientId,
AuthFlow = AuthFlowType.ADMIN_NO_SRP_ AUTH
};
request.AuthParameters.Add ("USERNAME ", "test@test.com");
request.AuthParameters.Add ("PASSWORD ", "P@ssword12");
var response = await cognito.AdminInitiateAuthA sync(reque st);
return strToken = response.AuthenticationRes ult.Access Token;
1. what are the next steps so that asp.net core web client is aware the user is logged in ??
example the below are set
User.Identity.IsAuthentica ted
User.Identity.Name
User.Claims
2. what other details from token need to be stored where and how in ASPNET Client so that these can be used to send in HTTPCLient request header to consume web api ?
3 When sending HTTPClient request to web API how to add the ID token in headed?
How to use AWS cognito user pool to authenticate and authorise ASP.NET Core WEb Client and ASP.NET Core Web API.
I already created a AWS Cognito User pool and App CLient.. I followed the below article from AWS
https://aws.amazon.com/blogs/mobile/use-csharp-to-register-and-authenticate-with-amazon-cognito-user-pools/
reached the point
var cognito = new AmazonCognitoIdentityProvi
//var cognito = new AmazonCognitoIdentityProvi
var request = new AdminInitiateAuthRequest
{
UserPoolId = _aWSConfig.PoolID,
ClientId = _clientId,
AuthFlow = AuthFlowType.ADMIN_NO_SRP_
};
request.AuthParameters.Add
request.AuthParameters.Add
var response = await cognito.AdminInitiateAuthA
return strToken = response.AuthenticationRes
1. what are the next steps so that asp.net core web client is aware the user is logged in ??
example the below are set
User.Identity.IsAuthentica
User.Identity.Name
User.Claims
2. what other details from token need to be stored where and how in ASPNET Client so that these can be used to send in HTTPCLient request header to consume web api ?
3 When sending HTTPClient request to web API how to add the ID token in headed?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.