private void Unauthenticated()
        {
            _statusUpdate(Name, "Enter Oauth ID (ie github key)");
            Receive <Input>(input =>
            {
                _service = Sender;
                Self.Tell(new Authenticate(input.Text));
            });

            Receive <Authenticate>(auth =>
            {
                //need a client to test our credentials with
                var client = GithubClientFactory.GetUnauthenticatedClient();
                GithubClientFactory.OAuthToken = auth.OAuthToken;
                client.Credentials             = new Credentials(auth.OAuthToken);
                BecomeAuthenticating();
                client.User.Current().ContinueWith <object>(tr =>
                {
                    if (tr.IsFaulted)
                    {
                        return(new AuthenticationFailed());
                    }
                    if (tr.IsCanceled)
                    {
                        return(new AuthenticationCancelled());
                    }
                    return(new AuthenticationSuccess());
                }).PipeTo(Self);
            });
        }
        /// <summary>
        ///     The unauthenticated.
        /// </summary>
        private void Unauthenticated()
        {
            this.Receive <Authenticate>(
                auth =>
            {
                // need a client to test our credentials with
                var client = GithubClientFactory.GetUnauthenticatedClient();
                GithubClientFactory.OAuthToken = auth.OAuthToken;
                client.Credentials             = new Credentials(auth.OAuthToken);
                this.BecomeAuthenticating();
                client.User.Current().ContinueWith <object>(
                    tr =>
                {
                    if (tr.IsFaulted)
                    {
                        return(new AuthenticationFailed());
                    }

                    if (tr.IsCanceled)
                    {
                        return(new AuthenticationCancelled());
                    }

                    return(new AuthenticationSuccess());
                }).PipeTo(this.Self);
            });
        }
 private void Unauthenticated()
 {
     Receive <Authenticate>(auth =>
     {
         //need a client to test our credentials with
         var client = GithubClientFactory.GetUnauthenticatedClient();
         GithubClientFactory.OAuthToken       = auth.OAuthToken;
         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
         client.Credentials = new Credentials(auth.OAuthToken);
         BecomeAuthenticating();
         client.User.Current().ContinueWith <object>(tr =>
         {
             if (tr.IsFaulted)
             {
                 return(new AuthenticationFailed());
             }
             if (tr.IsCanceled)
             {
                 return(new AuthenticationCancelled());
             }
             return(new AuthenticationSuccess());
         }).PipeTo(Self);
     });
 }