public static async Task SignInClientToCognito(string _username, string _password, int _clientid) { //CognitoUser user = new CognitoUser(_username, Constants.CLIENTAPP_ID, Server.cognitoManagerServer.userPool, Server.cognitoManagerServer.provider, Constants.NeokySecret); //CognitoUser user = Server.clients[_clientid].myUser; InitiateSrpAuthRequest authRequest = new InitiateSrpAuthRequest() { Password = _password }; //AuthFlowResponse authFlowResponse = null; //Console.WriteLine("GetUserAttribute | Pré - isValid : " + user.SessionTokens.IsValid().ToString()); // = Null while SRPAUTH not run try { Console.WriteLine("SignInClients.cs | Authentication Requested"); AuthFlowResponse authFlowResponse = await Server.clients[_clientid].myUser.StartWithSrpAuthAsync(authRequest).ConfigureAwait(false); Console.WriteLine("SignInClients.cs | Authentication Success"); //authFlowResponse.AuthenticationResult.RefreshToken //Server.clients[_clientid].accessToken = authFlowResponse.AuthenticationResult.AccessToken; // Only Loged In Users have their Access Token Set. if (authFlowResponse.ChallengeName == ChallengeNameType.NEW_PASSWORD_REQUIRED) { Console.WriteLine("SignInClients.cs | Challenge New Password Required"); // New Password Asked ServerSend.ClientNewPasswordRequired(_clientid, Constants.SCENE_REDEFINE_PWD); } else { Console.WriteLine("SignInClients.cs | Authentication Normal User"); UpdateUserAndSendIntoGame(_clientid, Constants.SCENE_AUTHENTICATION); // Set the Scene to Unload to Authentication Scene } } catch (Exception e) { HandleExceptions(e, _clientid, Constants.SCENE_AUTHENTICATION); } }