Пример #1
0
        public static SocialAdServiceClient GetServiceClientLoggedIn()
        {
            ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true;
            SocialAdServiceClient client = new SocialAdServiceClient("WSHttpBinding_ISocialAdService");

            client.ClientCredentials.UserName.UserName = AuthHelper.CurrentUser.Email;
            client.ClientCredentials.UserName.Password = AuthHelper.CurrentUser.Password;
            return(client);
        }
Пример #2
0
        public static SocialAdServiceClient GetServiceClientWithCredentials(string username, string password)
        {
            ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true;
            SocialAdServiceClient client = new SocialAdServiceClient("WSHttpBinding_ISocialAdService");

            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password;
            return(client);
        }
Пример #3
0
        static void Main(string[] args)
        {
            ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true;
            AuthServiceClient authClient = new AuthServiceClient();
            var isLoggedIn = authClient.Login("*****@*****.**", "!# test password #!");

            if (isLoggedIn)
            {
                Console.WriteLine("AuthService authentication succeeded.");
                SocialAdServiceClient cl = new SocialAdServiceClient();
                cl.ClientCredentials.UserName.UserName = "******";
                cl.ClientCredentials.UserName.Password = "******";
                var data = cl.getData();
                var post = cl.GenerateTestPost("Hvis dette virker, er det rigtig spændende.");
                Console.WriteLine(data);
                Console.WriteLine(post.DatePosted);
                Console.WriteLine(post.Content);
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Could not log in with AuthService.");
            }
        }