Пример #1
0
        /// <summary>
        /// 获取第三方授权地址
        /// </summary>
        /// <param name="redirectUrl"></param>
        /// <param name="state"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override string GetThirdOAuthUrl(string redirectUrl, string state = "", ThirdOAuthScope scope = ThirdOAuthScope.SnsapiBase)
        {
            redirectUrl = Utils.UrlEncode(redirectUrl);
            string wxScope        = scope == ThirdOAuthScope.SnsapiBase ? "snsapi_base" : "snsapi_userinfo";
            string wechatOauthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
            string oauthUrl       = $"{wechatOauthUrl}?appid={WechatConfig.AppId}&redirect_uri={redirectUrl}&response_type=code&scope={wxScope}&state={state}#wechat_redirect";

            return(oauthUrl);
        }
Пример #2
0
 /// <summary>
 /// 获取第三方授权地址
 /// </summary>
 /// <param name="redirectUrl"></param>
 /// <param name="state"></param>
 /// <param name="scope"></param>
 /// <returns></returns>
 public abstract string GetThirdOAuthUrl(string redirectUrl, string state = "", ThirdOAuthScope scope = ThirdOAuthScope.SnsapiBase);
Пример #3
0
        /// <summary>
        /// 获取第三方授权地址
        /// </summary>
        /// <param name="redirectUrl"></param>
        /// <param name="state"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override string GetThirdOAuthUrl(string redirectUrl, string state = "Alipay", ThirdOAuthScope scope = ThirdOAuthScope.SnsapiBase)
        {
            redirectUrl = Utils.UrlEncode(redirectUrl);
            string aliScope = scope == ThirdOAuthScope.SnsapiBase ? "auth_base" : "auth_user";
            string oauthUrl = $"{AliPayConfig.AppAuthorizeUrl}?app_id={AliPayConfig.AppId}&scope={aliScope}&redirect_uri={redirectUrl}&state={state}";

            return(oauthUrl);
        }