Beispiel #1
0
        public IEnumerator TestAuthenticateUltra()
        {
            if (!ServerUrl.Contains("api-internal.braincloudservers.com") &&
                !ServerUrl.Contains("internala.braincloudservers.com") &&
                !ServerUrl.Contains("api.internalg.braincloudservers.com"))
            {
                Debug.Log("This env doesn't support Ultra authentication type");
                Assert.True(true);
            }
            else
            {
                yield return(_tc.StartCoroutine(_tc.SetUpNewUser(Users.UserA)));

                _tc.bcWrapper.ScriptService.RunScript("getUltraToken", "{}", _tc.ApiSuccess, _tc.ApiError);
                yield return(_tc.StartCoroutine(_tc.Run()));

                var    data     = _tc.m_response["data"] as Dictionary <string, object>;
                var    response = data["response"] as Dictionary <string, object>;
                var    data2    = response["data"] as Dictionary <string, object>;
                var    json     = data2["json"] as Dictionary <string, object>;
                string idToken  = json["id_token"] as string;

                _tc.bcWrapper.PlayerStateService.Logout();
                yield return(_tc.StartCoroutine(_tc.Spin()));

                _tc.bcWrapper.AuthenticateUltra("braincloud1", idToken, true, _tc.ApiSuccess, _tc.ApiError);
                yield return(_tc.StartCoroutine(_tc.Run()));

                LogResults("Failed to authenticate ultra", _tc.successCount == 2);
            }
        }
        public void TestAuthenticateUltra()
        {
            if (!ServerUrl.Contains("api-internal.braincloudservers.com") &&
                !ServerUrl.Contains("internala.braincloudservers.com") &&
                !ServerUrl.Contains("api.internalg.braincloudservers.com"))
            {
                Console.WriteLine("This env doesn't support Ultra authentication type");
                Assert.True(true);
                return;
            }

            TestResult tr = new TestResult(_bc);

            _bc.Client.AuthenticationService.AuthenticateUniversal(
                GetUser(Users.UserA).Id,
                GetUser(Users.UserA).Password,
                true,
                tr.ApiSuccess, tr.ApiError);
            tr.Run();

            _bc.ScriptService.RunScript("getUltraToken", "{}", tr.ApiSuccess, tr.ApiError);
            tr.Run();

            var    data     = tr.m_response["data"] as Dictionary <string, object>;
            var    response = data["response"] as Dictionary <string, object>;
            var    data2    = response["data"] as Dictionary <string, object>;
            var    json     = data2["json"] as Dictionary <string, object>;
            string idToken  = json["id_token"] as string;

            _bc.PlayerStateService.Logout();

            _bc.AuthenticateUltra("braincloud1", idToken, true, tr.ApiSuccess, tr.ApiError);
            tr.Run();
        }