Esempio n. 1
0
        public ActionResult oauth2CodeCallback()
        {
            //Response.Headers.Add("Authorization", "Basic " + Base64Encode("gA6I9xiRgtW4xHBVK4sJ3T8aOomm99Pk" + ":" + "CR4zFn9ED8GlvAZi"));

            var authType   = Request.QueryString["state"];
            var authResult = String.Empty;

            if (authType == "authcodeflow")
            {
                Response.AddHeader("Authorization", "Basic " + HttpHelpers.Base64Encode("gA6I9xiRgtW4xHBVK4sJ3T8aOomm99Pk" + ":" + "CR4zFn9ED8GlvAZi"));

                var data = "code=" + Request.QueryString["code"] +
                           "&scope=" + Request.QueryString["scope"] +
                           //"&redirect_uri=http://localhost:38139/ready" +
                           "&grant_type=authorization_code";

                authResult = HttpHelpers.GetPostResponse("http://rmg-prod.apigee.net/v1/binary/oauth/accesstoken_authcode", data);
            }

            return(View((object)authResult));
        }