1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
【以下的回答经过翻译处理】 您可以通过下面的函数获取accessToken,这里是stackoverflow答案的链接。 https://stackoverflow.com/questions/66258459/how-to-get-aws-cognito-access-token-with-username-and-password-in-net-core-3-1
public static async Task<string> GetCredsAsync()
{
AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), Amazon.RegionEndpoint.USEast1);
CognitoUserPool userPool = new("", "", provider, "");
CognitoUser user = new("", "", userPool, provider, "");
InitiateSrpAuthRequest authRequest = new()
{
Password = ""
};
AuthFlowResponse authResponse = await user.StartWithSrpAuthAsync(authRequest).ConfigureAwait(false);
var accessToken = authResponse.AuthenticationResult.AccessToken;
return accessToken;
}
Contenus pertinents
- demandé il y a un mois
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an