我試圖在用戶服務器端簽署asp.net的Core 2登錄用戶/用戶進行身份驗證與AWS Cognito
我已經註冊了用戶,並驗證鏈接確認了,但現在我很努力簽署該用戶進入我的應用程序。遺憾的是,c#的文檔非常糟糕!
用戶池配置:
應用程序客戶端:啓用登錄基於服務器的身份驗證(ADMIN_NO_SRP_AUTH)API - 檢查
下面的代碼:
public async Task<bool> SignInUserAsync(CognitoUser user)
{
var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(),
RegionEndpoint.GetBySystemName("eu-west-2"));
try
{
var authReq = new AdminInitiateAuthRequest
{
AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH,
UserPoolId = _poolId,
ClientId = _clientId
};
authReq.AuthParameters.Add("USERNAME", user.Email);
authReq.AuthParameters.Add("PASSWORD", user.Password);
AdminInitiateAuthResponse authResp = await provider.AdminInitiateAuthAsync(authReq);
return true;
}
catch
{
return false;
}
}
的錯誤回報是Missing Authentication Token
,但我無法確定令牌需要設置/給予的位置。
它是下
AWS > User Pools > App Intergration > App Client Settings
的東西與我的AmazonCognitoIdentityProviderClient
設置或者是App客戶端的設置?