예제 #1
0
        private async System.Threading.Tasks.Task AutcheticateWithWSAsync(string password)
        {
            Configuration.Default.Timeout = new TimeSpan(0, 1, 0);

            var creds = new Password(password); // Password | A password key

            try
            {
                System.Threading.Tasks.Task <SessionResult> task = new DefaultApi().AuthTokenGetPostAsync(creds);
                SessionResult result = await task;
                // Upadting session and Api Key for future api calls until session needs to be renewed
                SessionHelper.UpdateSession(result);
                SocketHelper.ConnectToWS();
                Configuration.Default.AddApiKey("X-API-Key", result.Token);
                // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
                // Configuration.Default.ApiKeyPrefix.Add("X-API-Key", "Bearer");
            }
            catch (Exception eerr)
            {
                Debug.WriteLine("Exception when calling DefaultApi.AuthTokenGetPost: " + eerr.Message);
            }
        }