Пример #1
0
        private string RetrieveAccessToken(string authorizationCode)
        {
            var appId     = GetAppId();
            var appSecret = GetAppSecret();

            var returnUriValue = BuildCallbackUriValue();
            var param          = new NameValueCollection {
                { "client_id", appId },
                { "client_secret", appSecret },
                { "code", authorizationCode },
                { "grant_type", "authorization_code" },
                { "redirect_uri", returnUriValue },
            };
            var url = OAuthHelpers.BuildUri(OAuthUrl, "o/oauth2/token", new NameValueCollection());

            string accessToken = OAuthHelpers.GetObjectWithPost(url, param).access_token;

            return(accessToken);
        }