/// <summary> /// Step4:根据用户ID获取用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Weibo_UserShow_ResultEntity UserShow(Weibo_UserShow_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = NetnrCore.HttpTo.Get(WeiboConfig.API_UserShow + "?" + pars); var outmo = LoginBase.ResultOutput <Weibo_UserShow_ResultEntity>(result, new List <string> { "status" }); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="access_token"></param> /// <returns></returns> public static MicroSoft_User_ResultEntity User(string access_token) { if (string.IsNullOrWhiteSpace(access_token)) { return(null); } var hwr = NetnrCore.HttpTo.HWRequest($"{MicroSoftConfig.API_User}?access_token={NetnrCore.ToEncode(access_token)}"); hwr.ContentType = null; string result = NetnrCore.HttpTo.Url(hwr); var outmo = LoginBase.ResultOutput <MicroSoft_User_ResultEntity>(result, new List <string> { "emails" }); return(outmo); }
/// <summary> /// 获取 access token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Gitee_AccessToken_ResultEntity AccessToken(Gitee_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var hwr = LoginBase.HttpTo.HWRequest(GiteeConfig.API_AccessToken, "POST", pars); hwr.Accept = "application/json";//application/xml string result = LoginBase.HttpTo.Url(hwr); var outmo = LoginBase.ResultOutput <Gitee_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="access_token"></param> /// <returns></returns> public static GitHub_User_ResultEntity User(string access_token) { if (string.IsNullOrWhiteSpace(access_token)) { return(null); } var hwr = Core.HttpTo.HWRequest(GitHubConfig.API_User); hwr.Headers.Add("Authorization", $"token {access_token}"); hwr.UserAgent = "Netnr.Login"; string result = Core.HttpTo.Url(hwr); var outmo = LoginBase.ResultOutput <GitHub_User_ResultEntity>(result, new List <string> { "plan" }); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static MicroSoft_User_ResultEntity User(MicroSoft_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var hwr = Core.HttpTo.HWRequest(MicroSoftConfig.API_User + "?" + pars); hwr.ContentType = null; string result = Core.HttpTo.Url(hwr); var outmo = LoginBase.ResultOutput <MicroSoft_User_ResultEntity>(result, new List <string> { "emails" }); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Gitee_User_ResultEntity User(Gitee_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var hwr = LoginBase.HttpTo.HWRequest(GiteeConfig.API_User + "?" + pars); hwr.UserAgent = entity.ApplicationName; string result = LoginBase.HttpTo.Url(hwr); var outmo = LoginBase.ResultOutput <Gitee_User_ResultEntity>(result, new List <string> { "plan" }); return(outmo); }
/// <summary> /// Step3:获取用户OpenId /// </summary> /// <param name="entity"></param> /// <returns></returns> public static QQ_OpenId_ResultEntity OpenId(QQ_OpenId_RequestEntity entity) { var mo = new QQ_OpenId_ResultEntity(); var pis = mo.GetType().GetProperties(); if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = LoginBase.RequestTo.Url(QQConfig.API_OpenID_PC + "?" + pars); //callback( {"client_id":"xx12196xx","openid":"09196B48CA96A8C8ED4FFxxCBxx59Dxx"} ); result = result.Replace("callback( ", "").Replace(" );", ""); var outmo = LoginBase.ResultOutput <QQ_OpenId_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity">签名参数</param> /// <returns></returns> public static StackOverflow_User_ResultEntity User(StackOverflow_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = NetnrCore.HttpTo.Get(StackOverflowConfig.API_User + "?" + pars); StackOverflow_User_ResultEntity outmo = null; var jo = JObject.Parse(result); if (jo.ContainsKey("items")) { outmo = LoginBase.ResultOutput <StackOverflow_User_ResultEntity>(NetnrCore.ToJson(jo["items"][0])); } return(outmo); }
/// <summary> /// Step2:通过Authorization Code获取Access Token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static QQ_AccessToken_ResultEntity AccessToken(QQ_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = NetnrCore.HttpTo.Get(QQConfig.API_AccessToken_PC + "?" + pars); List <string> listPars = result.Split('&').ToList(); var jo = new JObject(); foreach (string item in listPars) { var items = item.Split('=').ToList(); jo[items.FirstOrDefault()] = items.LastOrDefault(); } var outmo = LoginBase.ResultOutput <QQ_AccessToken_ResultEntity>(Newtonsoft.Json.JsonConvert.SerializeObject(jo)); return(outmo); }