Пример #1
0
        public IActionResult callback(string code, string state, string data)
        {
            var result = JsonConvert.DeserializeObject <M_APIResult <M_AccessToken> >(data);

            if (result.State == false)
            {
                return(Ok(result.Error.errmsg));
            }
            Console.WriteLine(WebPageAuthorizeHelper.IsAccessTokenLose(result.Data.access_token, result.Data.openid).Result.Data.errmsg);
            if (result.Data.scope.ToLower() == Summary.E_AuthorizeScope.snsapi_userinfo.ToString().ToLower())
            {
                var userinfo = WebPageAuthorizeHelper.GetUserInfo(result.Data.access_token, result.Data.openid).Result;
                return(Ok(userinfo.Data.nickname));
            }
            return(Ok(result.Data.access_token + "@" + result.Data.scope));
        }
Пример #2
0
 public string Authorize()
 {
     return(WebPageAuthorizeHelper.BuildAuthorizeUrl("http://shimiao.ren:8100/WebPage/callback", Summary.E_AuthorizeScope.snsapi_userinfo));
 }