Ejemplo n.º 1
0
        public async Task <string> RegisterFB(string user, string fbId, string email)
        {
            AWSOAuth awsOAuth = AWSOAuth.GetAWSOAuth();
            // string s = await awsOAuth.RegisterFB(userid, fbId, email);
            string err = await Signup(awsOAuth.GetUserFB(user), email, awsOAuth.GetPwdFB(fbId));

            if (err != null && err.Contains("ser already exists"))
            {
                return(await Login(awsOAuth.GetUserFB(user), awsOAuth.GetPwdFB(fbId)));
            }
            return(err);
        }
Ejemplo n.º 2
0
        public OAuthManager()
        {
            Debug.Log("AuthManager.Start!!" + passwordManager);
            interoCloud     = new InteroCloudUnity();
            passwordManager = new PasswordManager();
            //  us-east-2_wLCz3abPT
            // AWSOAuth.GetAWSOAuth("18d734o5tvojknm4o6vmf8coq4", "us-east-2_HsVe2qOzQ");
#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_IOS
            AWSOAuth.GetAWSOAuth("64jsgepmoinesh86kdpbumjr94", "us-east-2_wLCz3abPT");
#elif UNITY_ANDROID
            PluginCognito.InitCognito();//"4qbeb3enoaa626k42jjjpl6c31", "us-east-2_FaXVRBzfG");
#endif
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public async Task <string> Login(string username, string password, bool saveCreds = true)
        {
            string s;

#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_IOS
            AWSOAuth awsOAuth = AWSOAuth.GetAWSOAuth();
            Debug.Log("AWSOAuth " + awsOAuth);
            s = await awsOAuth.SignInUser(username, password);

            Debug.Log("Singing after " + s);
            if (s == null || s.Length < 1)
            {
                accessToken = awsOAuth.GetOAuthToken();
            }
#elif UNITY_ANDROID
            Debug.Log("Login 6969 android");
            LoginInfo loginInfo = await PluginCognito.SignIn(username, password);

            s = loginInfo.error == "" ? null : loginInfo.error;
            Debug.Log("Login 6969 error " + s);
            accessToken = loginInfo.accessToken;
            Debug.Log("Login 6969 tok " + accessToken);
#endif
            if (s == null || s.Length < 1)
            {
                Debug.Log("Setting access tok " + accessToken);
                interoCloud.SetOAuthHeader(accessToken);
                if (saveCreds)
                {
                    passwordManager.SaveCredentials(username, password);
                }
                Debug.Log("No error " + s + " toc " + accessToken);
            }
            Debug.Log("jojo " + s);
            return(s);
        }
Ejemplo n.º 5
0
        public async Task <string> LoginFB(string username, string fbId)
        {
            AWSOAuth awsOAuth = AWSOAuth.GetAWSOAuth();

            return(await Login(awsOAuth.GetUserFB(username), awsOAuth.GetPwdFB(fbId)));
        }