· 7 years ago · Nov 21, 2018, 11:04 AM
1private static async void SignInUserAsync()
2{
3 var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), RegionEndpoint.GetBySystemName("us-east-1"));
4 try
5 {
6 string Access_Key = "ZZZZZZZZZZZZOOOOOOO";
7 string Secret_Key = "XXXXXXXXXXYYYYYYYYYYYYY";
8
9 var authReq = new AdminInitiateAuthRequest
10 {
11 AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH,
12 UserPoolId = Access_Key,
13 ClientId = Secret_Key
14 };
15
16 AdminInitiateAuthResponse authResp = await provider.AdminInitiateAuthAsync(authReq);
17
18 if (authResp != null)
19 {
20 Console.WriteLine("Autenticação ok!");
21 }
22 else
23 {
24 Console.WriteLine("falhou!");
25 }
26
27 }
28 catch (Exception ex)
29 {
30 throw new Exception(ex.Message);
31 }
32}