Ejemplo n.º 1
0
        public async Task <string> Signup(string user, string email, string pass)
        {
            string s = null;

#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_IOS
            AWSOAuth awsOAuth = AWSOAuth.GetAWSOAuth();
            s = await awsOAuth.Register(user, email, pass);

            Debug.Log("Signup error " + s);
            if (s == null || s.Length < 1)
            {
                // accessToken = awsOAuth.GetAccessToken();
                return(await Login(user, pass, true));
            }
#elif UNITY_ANDROID
            LoginInfo loginInfo = await PluginCognito.SignUp(user, email, pass);

            Debug.Log(" await PluginCognito.SignUp1 " + loginInfo.error);
            s = loginInfo.error == "" ? null : loginInfo.error;
            Debug.Log(" await PluginCognito.SignUp2 " + s);

            if (s == null || s.Length < 1)
            {
                accessToken = loginInfo.accessToken;
                Debug.Log("Setting access tok " + accessToken);
                interoCloud.SetOAuthHeader(accessToken);
                passwordManager.SaveCredentials(user, pass);
            }
#endif

            /*
             * if (s == null || s.Length < 1)
             * {
             *  passwordManager.SaveCredentials(user, pass);
             *  interoCloud.SetOAuthHeader(accessToken);
             * }
             */
            UnityEngine.Debug.Log("error " + s);
            return(s);
        }