Exemple #1
0
        /**
         *              received first boot authentication result.
         *              if failed to validate response, call bootAuthFailed(int errorCode, string reason).
         *                      this bootAuthFailed method raises the notification against Autoya.Auth_SetOnBootAuthFailed() handler.
         */
        private IEnumerator OnBootAuthResponse(Dictionary <string, string> responseHeader, string data, Action <int, string> bootAuthFailed)
        {
            var isValidResponse = true;

            if (isValidResponse)
            {
                Autoya.Persist_Update(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN, AuthSettings.AUTH_STORED_TOKEN_FILENAME, data);
            }
            else
            {
                bootAuthFailed(-1, "failed to boot validation.");
            }
            yield break;
        }
Exemple #2
0
        /**
         *              received refreshed token.
         *              if failed to validate response, call refreshFailed(int errorCode, string reason).
         *                      this refreshFailed method raises the notification against Autoya.Auth_SetOnRefreshAuthFailed() handler.
         */
        private IEnumerator OnTokenRefreshResponse(Dictionary <string, string> responseHeader, string data, Action <int, string> refreshFailed)
        {
            var isValidResponse = true;

            if (isValidResponse)
            {
                Autoya.Persist_Update(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN, AuthSettings.AUTH_STORED_TOKEN_FILENAME, data);
            }
            else
            {
                // failsafe here.


                // set result as failure.
                refreshFailed(-1, "failed to refresh token.");
            }

            yield break;
        }