예제 #1
0
파일: OAuth.cs 프로젝트: david-js/.net-sdk
        /// <summary>
        /// Request access token for an app key, client secret and authorization code
        /// </summary>
        /// <param name="httpContext">current application context</param>
        /// <param name="code">authorization code</param>
        /// <param name="redirectUrl">where to redirect after authentication, must match configuration on Constant Contact site</param>
        /// <returns>access token</returns>
        public static string GetAccessTokenByCode(HttpContext httpContext, string code, string redirectUrl = null)
        {
            var webForm = new AuthenticationWebPage(httpContext, null, redirectUrl);

            return(webForm.GetAccessTokenByCode(code));
        }
예제 #2
0
파일: OAuth.cs 프로젝트: david-js/.net-sdk
        /// <summary>
        /// Sends an authorization request to Constant Contact API
        /// (if access to application is granted, a code is send to Redirect URL field)
        /// (Redirect URL is one of web application url pages/methods)
        /// </summary>
        /// <param name="httpContext">current application context</param>
        /// <param name="state">state query parameter</param>
        /// <param name="redirectUrl">where to redirect after authentication, must match configuration on Constant Contact site</param>
        public static void AuthorizeFromWebApplication(HttpContext httpContext, string state, string redirectUrl = null)
        {
            var webForm = new AuthenticationWebPage(httpContext, state, redirectUrl);

            webForm.GetAuthorizationCode();
        }
예제 #3
0
파일: OAuth.cs 프로젝트: david-js/.net-sdk
        /// <summary>
        /// Returns the redirect URL to make an authorization request to Constant Contact API
        /// (if access to application is granted, a code is sent to Redirect URL field)
        /// (Redirect URL is one of web application url pages/methods)
        /// </summary>
        /// <param name="httpContext">current application context</param>
        /// <param name="state">state query parameter</param>
        /// <param name="redirectUrl">where to redirect after authentication, must match configuration on Constant Contact site</param>
        public static string GetUrlToAuthorizeFromWebApplication(HttpContext httpContext, string state, string redirectUrl = null)
        {
            var webForm = new AuthenticationWebPage(httpContext, state, redirectUrl);

            return(webForm.GetAuthorizationCodeUrl());
        }
예제 #4
0
파일: OAuth.cs 프로젝트: david-js/.net-sdk
 /// <summary>
 /// Set CTCT configuration information if the api key and client secret are stored somewhere besides the default names in the configuration settings.
 /// This method is optional, and if it is not called, the configuration is queried for these values.
 /// </summary>
 /// <param name="apiKey"></param>
 /// <param name="clientSecret"></param>
 public static void Initialize(string apiKey, string clientSecret)
 {
     AuthenticationWebPage.Initialize(apiKey, clientSecret);
 }