コード例 #1
0
        /// <summary>
        /// 授权并跳转
        /// </summary>
        /// <param name="code">用户同意授权后,返回的code,用于获取access_token获取用户信息</param>
        /// <param name="state">state参数,这里传递公众号id</param>
        /// <param name="returnUrl"></param>
        public IActionResult AuthorizeUrl(string code, string state, string returnUrl)
        {
            if (string.IsNullOrWhiteSpace(code) || code == "authdeny")
            {
                return(Content("授权失败"));
            }

            var url = _authSrv.Authorize(code, returnUrl);

            return(Redirect(url));
        }