예제 #1
0
        private void getUserInfo(VKontakteSocialUserInfo vkUserInfo)
        {
            dynamic responseCommon = WebClient.GetJsonAsDynamic(GETUSERINFO_BASEURL, this, HTTPRequestMethod.GET, new Dictionary <string, string>()
            {
                { USERINFO_USERID_PARAMNAME, vkUserInfo.ID.ToString() },
                { USERINFO_FIELDS_PARAMNAME, USERINFO_FIELDS_PARAMVALUE },
                { ACCESSTOKEN_PARAMNAME, vkUserInfo.AccessToken }
            });

            dynamic responseObj = responseCommon.response[0];

            vkUserInfo.LoginState = SocialLoginState.LoggedIn;
            vkUserInfo.FirstName  = responseObj[USERINFO_FIRSTNAME_PARAMNAME];
            vkUserInfo.LastName   = responseObj[USERINFO_LASTNAME_PARAMNAME];
            vkUserInfo.Nickname   = responseObj[USERINFO_NICKNAME_PARAMNAME];
            vkUserInfo.Photo      = responseObj[USERINFO_PHOTO_PARAMNAME];
        }
예제 #2
0
        protected override void DoObtainTokens(SocialUserInfo userInfo, JSONDataMap request, string returnPageURL)
        {
            var code = request[ACCESSTOKEN_CODE_PARAMNAME].AsString();

            if (code.IsNullOrWhiteSpace())
            {
                throw new NFXException(StringConsts.ARGUMENT_ERROR + GetType().Name + ".GetUserInfo(request should contain code)");
            }

            VKontakteSocialUserInfo vkUserInfo = userInfo as VKontakteSocialUserInfo;

            string returnURL = PrepareReturnURLParameter(returnPageURL);

            dynamic accessTokenObj = getAccessTokenObj(code, returnURL);

            vkUserInfo.AccessToken = accessTokenObj[ACCESSTOKEN_PARAMNAME];
            vkUserInfo.ID          = (accessTokenObj[ACCESSTOKEN_USERID_PARAMNAME]).ToString();
        }
예제 #3
0
파일: VKontakte.cs 프로젝트: itadapter/nfx
        private void getUserInfo(VKontakteSocialUserInfo vkUserInfo)
        {
            dynamic responseCommon = WebClient.GetJsonAsDynamic(GETUSERINFO_BASEURL, this, HTTPRequestMethod.GET, new Dictionary<string, string>() {
              {USERINFO_USERID_PARAMNAME, vkUserInfo.ID.ToString()},
              {USERINFO_FIELDS_PARAMNAME, USERINFO_FIELDS_PARAMVALUE},
              {ACCESSTOKEN_PARAMNAME, vkUserInfo.AccessToken}
            });

            dynamic responseObj = responseCommon.response[0];

            vkUserInfo.LoginState = SocialLoginState.LoggedIn;
            vkUserInfo.FirstName = responseObj[USERINFO_FIRSTNAME_PARAMNAME];
            vkUserInfo.LastName = responseObj[USERINFO_LASTNAME_PARAMNAME];
            vkUserInfo.Nickname = responseObj[USERINFO_NICKNAME_PARAMNAME];
            vkUserInfo.Photo = responseObj[USERINFO_PHOTO_PARAMNAME];
        }