Ejemplo n.º 1
0
        protected void LoginWithtUser(User user)
        {
            //LoginWithtUser(user.Username, user.Password);
            var cookies = LoginAPI.Login(user);

            Driver.SetCookies(cookies);
            Driver.Current.Url = "https://www.kika.lt/";
            Driver.WriteAllCookies();
        }
        public async Task <AuthResponse> Login(User user)
        {
            IsBusy = true;

            SHA256 sha256Hash = SHA256.Create();

            byte[] networkStatus1Bytes = Encoding.UTF8.GetBytes(user.networkStatus1);
            byte[] networkStatus2Bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(user.networkStatus2));

            User reqObj = new User()
            {
                networkStatus1 = Convert.ToBase64String(networkStatus1Bytes),
                networkStatus2 = Convert.ToBase64String(networkStatus2Bytes)
            };

            var res = await loginAPI.Login(reqObj);

            IsBusy = false;
            return(res);
        }
Ejemplo n.º 3
0
 public void Test1()
 {
     LoginAPI.Login(User.DefaultKikaUser);
 }
Ejemplo n.º 4
0
        private IEnumerator AuthenticateParallel(object authData)
        {
            endPoint.AddData("stoken", Hub.ApiEndPoint.GetData("stoken"));

            bool?  prelogin     = null;
            object preloginData = null;

            EB.Debug.Log("HuaweiSDKManager.Authenticate: Start PreLogin");
            api.PreLogin(delegate(string preloginError, object preloginResult)
            {
                if (!string.IsNullOrEmpty(preloginError))
                {
                    prelogin = false;

                    var url = Dot.String("url", preloginResult, null);
                    if (!string.IsNullOrEmpty(url))
                    {
                        Hub.Config.LoginConfig.Listener.OnUpdateRequired(url);
                        return;
                    }
                    else
                    {
                        Hub.FatalError(preloginError);
                        return;
                    }
                }

                prelogin     = true;
                preloginData = preloginResult;
                EB.Debug.Log("HuaweiSDKManager.Authenticate: PreLogin Success");
            });

            while (!prelogin.HasValue)
            {
                yield return(null);
            }

            if (!prelogin.Value)
            {
                yield break;
            }

            var salt = Dot.String("salt", preloginData, string.Empty);

            yield return(Coroutines.Run(Protect.CalculateHmac(salt, delegate(string challenge)
            {
                var securityData = new Hashtable();
                securityData["salt"] = salt;
                securityData["chal"] = challenge;

                EB.Debug.Log("HuaweiSDKManager.Authenticate: Start Login");
                api.Login("huawei", new Hashtable()
                {
                    { "huawei", authData }
                }, securityData, delegate(string loginError, object loginResult)
                {
                    if (!string.IsNullOrEmpty(loginError))
                    {
                        Hub.FatalError(loginError);
                        return;
                    }

                    EB.Debug.Log("HuaweiSDKManager.Authenticate: Login success");
                });
            })));
        }