Esempio n. 1
0
        public ActionResult SignIn(FormCollection collection)
        {
            try
            {
                var authToken = collection.Get("oauth");
                if (authToken == null)
                {
                    return(RedirectToAction("Index", "Login"));
                }
                //if cookie doesnt exist
                var encodedTokenArray = System.Text.Encoding.UTF8.GetBytes(authToken);

                // make get request to get current user information from SC

                //TODO 'authToken' needs to be encrypted
                CookieHandler.generateCookie(HttpContext.Response.Cookies, "SoundCloudToken", authToken);

                // make get request to get current user information from SC
                /* this could all be in a class file. can make the api urls constants */

                return(RedirectToAction("Index", "User"));
            }
            catch
            {
                return(View());
                //return RedirectToAction("Index");
            }
        }