private string GetAccessToken(string authorizationCode, Uri returnUrl) { var param = new NameValueCollection { { "client_id", _appId }, { "client_secret", _appSecret }, { "code", authorizationCode }, { "grant_type", "authorization_code" }, { "redirect_uri", returnUrl.GetLeftPart(UriPartial.Path) }, }; var url = OAuthHelpers.BuildUri(OAuthUrl, "o/oauth2/token", new NameValueCollection()); return(OAuthHelpers.GetObjectWithPost(url, param).access_token); }
private UserInfo GetAccessInfo(string code) { var param = new NameValueCollection { { "client_id", _clientId }, { "client_secret", _clientSecret }, { "code", code }, { "grant_type", "authorization_code" }, { "redirect_uri", _redirectUri } }; var url = OAuthHelpers.BuildUri(OAuthUrl, OauthAccessTokenPath, new NameValueCollection()); var response = OAuthHelpers.GetObjectWithPost(url, param); return(new UserInfo { Id = response.user.id, UserName = response.user.full_name }); }