コード例 #1
0
        private static UserInfo GetUserData(string accessToken)
        {
            var uri      = CreateUserInfoUri(accessToken);
            var response = OAuthHelpers.GetObjectFromAddress(uri);

            return(new UserInfo {
                Id = response.id,
                UserName = String.Format("{0} {1}", response.first_name, response.last_name)
            });
        }
コード例 #2
0
        private static UserInfo GetUserData(string userId)
        {
            var address  = CreateUserInfoUri(userId);
            var response = OAuthHelpers.GetObjectFromAddress(address);
            var user     = response.response[0];

            return(new UserInfo {
                Id = user.uid,
                UserName = String.Format("{0} {1}", user.first_name, user.last_name)
            });
        }
コード例 #3
0
        private static UserInfo GetUserData(string accessToken)
        {
            var address  = CreateUserDataUri(accessToken);
            var response = OAuthHelpers.GetObjectFromAddress(address);
            var url      = new Uri(response.siteStandardProfileRequest.url.ToString());
            var id       = HttpUtility.ParseQueryString(url.Query).Get("id");

            return(new UserInfo {
                Id = id,
                UserName = String.Format("{0} {1}", response.firstName, response.lastName)
            });
        }
コード例 #4
0
        private static UserInfo GetUserData(string accessToken)
        {
            var uri = OAuthHelpers.BuildUri(ApiUrl, "oauth2/v1/userinfo", new NameValueCollection {
                { "access_token", accessToken }
            });

            var response = OAuthHelpers.GetObjectFromAddress(uri);

            return(new UserInfo {
                Id = response.id,
                UserName = response.name
            });
        }
コード例 #5
0
        private string GetAccessToken(HttpContextBase context)
        {
            var address = CreateAccessTokenUri(context);

            return(OAuthHelpers.GetObjectFromAddress(address).access_token);
        }
コード例 #6
0
        private string GetAccessToken(string code)
        {
            var address = CreateBuildUri(code);

            return(OAuthHelpers.GetObjectFromAddress(address).user_id);
        }