INgageNetworks.Api.Authenticate C# (CSharp) Method

Authenticate() public method

public Authenticate ( ) : void
return void
        public void Authenticate()
        {
            var request = new RestRequest("/", Method.GET) { RequestFormat = DataFormat.Json };
            request.AddHeader("api-key", _apiKey);
            var stsClient = new RestClient(BaseSecureUrl)
            {
                Authenticator = new HttpBasicAuthenticator(_userName, _password)
            };

            stsClient.GetAsync<Token>(request,
                                      (response, handle) =>
                                      {
                                          if (response.StatusCode == HttpStatusCode.OK)
                                              if (response.Data != null) _accessToken = response.Data.AccessToken;
                                              else if (response.ErrorException != null)
                                                  throw response.ErrorException;
                                      }
                );
        }