[MTest] public void HandleBootAuthFailed() { Autoya.forceFailFirstBoot = true; Autoya.Auth_DeleteAllUserData(); var bootAuthFailHandled = false; Autoya.Auth_SetOnBootAuthFailed( (code, reason) => { bootAuthFailHandled = true; } ); RunOnMainThread( () => Autoya.Auth_AttemptAuthentication() ); WaitUntil( () => bootAuthFailHandled, 10, "failed to handle bootAuthFailed." ); Autoya.forceFailFirstBoot = false; }
public IEnumerator HandleBootAuthFailed() { Autoya.forceFailFirstBoot = true; Autoya.Auth_Logout(); var bootAuthFailHandled = false; Autoya.Auth_SetOnBootAuthFailed( (code, reason) => { bootAuthFailHandled = true; } ); Autoya.Auth_AttemptAuthenticationIfNeed(); yield return(WaitUntil( () => bootAuthFailHandled, () => { throw new TimeoutException("failed to handle bootAuthFailed."); }, 10 )); Autoya.forceFailFirstBoot = false; }
// Use this for initialization IEnumerator Start() { Autoya.Auth_SetOnBootAuthFailed( (code, reason) => { Debug.Log("code:" + code + " reason:" + reason); } ); while (!Autoya.Auth_IsAuthenticated()) { Debug.Log("waiting.."); yield return(null); } var connectionId1 = Autoya.Http_Get( "https://httpbin.org/get", // url (conId, data) => { // on succeeded Debug.Log("get data:" + data); }, (conId, code, reason, autoyaStatus) => { // on failed Debug.LogError("code:" + code + " reason:" + reason); }, new Dictionary <string, string>(), // headers 3.0 // timeout ); Debug.Log("start get with connectionId:" + connectionId1); var postData = "hello world."; var connectionId2 = Autoya.Http_Post( "https://httpbin.org/post", postData, (conId, resultData) => { Debug.Log("post data:" + resultData); }, (conId, code, reason, autoyaStatus) => { Debug.LogError("code:" + code + " reason:" + reason); } ); Debug.Log("start post with connectionId:" + connectionId2); }
public IEnumerator Setup() { Autoya.ResetAllForceSetting(); var dataPath = Application.persistentDataPath; var fwPath = Path.Combine(dataPath, AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN); DeleteAllData(fwPath); Autoya.TestEntryPoint(dataPath); while (!Autoya.Auth_IsAuthenticated()) { yield return(false); } var authenticated = false; Autoya.Auth_SetOnAuthenticated( () => { authenticated = true; } ); Autoya.Auth_SetOnBootAuthFailed( (code, reason) => { Debug.LogError("code:" + code + " reason:" + reason); } ); yield return(WaitUntil( () => authenticated, () => { throw new TimeoutException("failed to auth."); } )); True(Autoya.Auth_IsAuthenticated(), "not logged in."); }