Uri url = new Uri("https://login.live.com/oauth20_authorize.srf");
using (var wb = new WebClient())
{
var data = new NameValueCollection();
data["client_id"] = "000000004012B29D";
data["scope"] = "wl.signin%20wl.basic%20wl.offline_access";
data["response_type"] = "code";
data["redirect_uri"] = "https://login.live.com/oauth20_desktop.srf";
var response = wb.UploadValues(url, "POST", data);
}
我很可能认为我的 post-request 是错误的,但不知道为什么,我唯一怀疑的是我添加了范围,%20 是一个简单的空间,我不确定我是否可以这样写。我应该收到一个 resulturl 吗?但我得到的只是这个 html 代码:
"<!-- ServerInfo: BAYIDSLGN3A089 2014.10.28.00.06.35 Live1 ExclusiveNew LocVer:0 -->\r\n<!-- PreprocessInfo: BTSA007:RR1BLDA080, -- Version: 16,0,25347,0 -->\r\n<html dir=\"ltr\">\r\n <head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n <base href=\"https://login.live.com/pp1600/\"/>\r\n \r\n \r\n \t\r\n \r\n \r\n \t\t\r\n <title>Microsoft account</title>\r\n <meta name=\"PageID\" content=\"i4400\">\r\n <meta name=\"SiteID\" content=\"38936\">\r\n <meta name=\"ReqLC\" content=\"1033\">\r\n <meta name=\"LocLC\" content=\" \">\r\n <link rel=\"stylesheet\" type=\"text/css\" href=\"CSS/WEBblue1033.css?x=16.0.25000.0\"/>\r\n <script type=\"text/javascript\">\r\n function EndPPCRL(rs, u) \r\n {\r\n if (external) \r\n {\r\n try \r\n {\r\n if (rs) \r\n {\r\n external.RequestStatus = rs;\r\n external.WebFlowUrl = u;\r\n external.NotifyIdentityChanged();\r\n external.ReturnToApp();\r\n }\r\n else \r\n {\r\n external._b7(); external.BrowseToAuthUI();\r\n }\r\n } \r\n catch (e) { }\r\n }\r\n } \r\n function BodyLoad() \r\n { \r\n EndPPCRL(-2147186656); \r\n }\r\n </script>\r\n <script type=\"text/javascript\">\r\n WizardExternalHelper = function(){ };\r\n WizardExternalHelper.prototype =\r\n {\r\n setProperty: function(key, value) \r\n { \r\n try\r\n { \r\n window.external.Property(key) = value;\r\n }\r\n catch (e) { }\r\n },\r\n finalNext: function()\r\n { \r\n try\r\n { \r\n window.external.FinalNext();\r\n }\r\n catch (e) { }\r\n }\r\n };\r\n </script>\r\n <script type=\"text/javascript\">\r\n try \r\n {\r\n var externalHelper = new WizardExternalHelper();\r\n externalHelper.setProperty(\"ExtendedErrorString\", \"\");\r\n externalHelper.setProperty(\"ErrorCode\", parseInt(1));\r\n externalHelper.setProperty(\"ErrorString\", \"This service isn't available right now—please try again later.\");\r\n externalHelper.finalNext();\r\n } catch (e) {};\r\n function OnBack() {}; \r\n function OnNext() {};\r\n </script>\r\n </head>\r\n <body class=\"modern\" onLoad=\"BodyLoad()\">\r\n <div class=\"header\" id=\"idHeaderTD9\">\r\n <span>Microsoft account</span>\r\n </div>\r\n <div class=\"content\">\r\n \r\n \t\r\n \r\n <div style=\"padding:15px 0 0 0;font-size:1px;\"> </div>\r\n <h1 class=\"css0046\">We're unable to complete your request</h1>\r\n <p class=\"css0005\">Microsoft account is experiencing technical problems. Please try again later.</p>\r\n \t\t\r\n </div>\r\n </body>\r\n</html>\r\n<!-- _h-Agent: -->\r\n\r\n"