/// <summary> /// Step2:通过Authorization Code获取Access Token、openid /// </summary> /// <param name="entity"></param> /// <returns></returns> public static WeChat_AccessToken_ResultEntity AccessToken(WeChat_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = LoginBase.HttpTo.Url(WeChatConfig.API_AccessToken + "?" + pars); var outmo = LoginBase.ResultOutput <WeChat_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 access token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Google_AccessToken_ResultEntity AccessToken(Google_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = NetnrCore.HttpTo.Post(GoogleConfig.API_AccessToken, pars); var outmo = LoginBase.ResultOutput <Google_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Google_User_ResultEntity User(Google_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = Core.HttpTo.Get(GoogleConfig.API_User + "?" + pars); var outmo = LoginBase.ResultOutput <Google_User_ResultEntity>(result); return(outmo); }
/// <summary> /// Step2:获取授权过的Access Token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Taobao_AccessToken_ResultEntity AccessToken(Taobao_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = LoginBase.RequestTo.Url(TaobaoConfig.API_AccessToken, pars); var outmo = LoginBase.ResultOutput <Taobao_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取access_token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static StackOverflow_AccessToken_ResultEntity AccessToken(StackOverflow_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = Core.HttpTo.Post(StackOverflowConfig.API_AccessToken, pars); result = "{\"" + result.Replace("=", "\":\"").Replace("&", "\",\"") + "\"}"; var outmo = LoginBase.ResultOutput <StackOverflow_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 请求授权地址 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(Gitee_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { GiteeConfig.API_Authorize, "?client_id=", entity.client_id, "&response_type=", entity.response_type, "&state=", entity.state, "&redirect_uri=", entity.redirect_uri.ToEncode() })); }
/// <summary> /// 请求授权地址 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(StackOverflow_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { StackOverflowConfig.API_Authorize, "?client_id=", entity.client_id, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", entity.redirect_uri.ToEncode() })); }
/// <summary> /// Step1:获取Authorization Code /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizationHref(WeChat_Authorization_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { WeChatConfig.API_Authorization, "?appid=", entity.appid, "&response_type=", entity.response_type, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", NetnrCore.ToEncode(entity.redirect_uri) })); }
/// <summary> /// 请求授权地址,密码登录 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref_Password(DingTalk_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { DingTalkConfig.API_Authorize_Password, "?appid=", entity.appid, "&response_type=", entity.response_type, "&scope=", entity.scope, "&state=", entity.state, "&redirect_uri=", entity.redirect_uri.ToEncode() })); }
/// <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 = Core.HttpTo.Get(StackOverflowConfig.API_User + "?" + pars); StackOverflow_User_ResultEntity outmo = null; var jo = result.ToJObject(); if (jo.ContainsKey("items")) { outmo = LoginBase.ResultOutput <StackOverflow_User_ResultEntity>(jo["items"][0].ToJson()); } return(outmo); }
/// <summary> /// Step1:请求用户授权Token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string AuthorizeHref(Taobao_Authorize_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } return(string.Concat(new string[] { TaobaoConfig.API_Authorize, "?response_type=", entity.response_type, "&client_id=", entity.client_id, "&redirect_uri=", LoginBase.EncodeUri(entity.redirect_uri), "&state=", entity.state, "&view=", entity.view })); }