GetCallbackUrlFromContext() static private method

static private GetCallbackUrlFromContext ( ) : Uri
return System.Uri
Example #1
0
        /// <summary>
        /// Requests authorization from Google to access data from a set of Google applications.
        /// </summary>
        /// <param name="requestedAccessScope">The requested access scope.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// A task that completes with the asynchronous operation.
        /// </returns>
        public Task <Uri> RequestUserAuthorizationAsync(Applications requestedAccessScope, CancellationToken cancellationToken = default(CancellationToken))
        {
            var extraParameters = new Dictionary <string, string> {
                { "scope", GetScopeUri(requestedAccessScope) },
            };
            Uri callback = Util.GetCallbackUrlFromContext();

            return(this.RequestUserAuthorizationAsync(callback, extraParameters, cancellationToken));
        }
Example #2
0
        //http://api.linkedin.com/v1/people/~
        public static void RequestAuthorization(WebConsumer consumer)
        {
            if (consumer == null)
            {
                throw new ArgumentNullException("consumer");
            }
            Uri callback = Util.GetCallbackUrlFromContext().StripQueryArgumentsWithPrefix("oauth_");
            var request  = consumer.PrepareRequestUserAuthorization(callback, null, null);

            consumer.Channel.Send(request);
        }
Example #3
0
        /// <summary>
        /// Requests authorization from Google to access data from a set of Google applications.
        /// </summary>
        /// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param>
        /// <param name="requestedAccessScope">The requested access scope.</param>
        public static void RequestAuthorization(WebConsumer consumer, Applications requestedAccessScope)
        {
            if (consumer == null)
            {
                throw new ArgumentNullException("consumer");
            }

            var extraParameters = new Dictionary <string, string> {
                { "scope", GetScopeUri(requestedAccessScope) },
            };
            Uri callback = Util.GetCallbackUrlFromContext();
            var request  = consumer.PrepareRequestUserAuthorization(callback, extraParameters, null);

            consumer.Channel.Send(request);
        }
        //http://api.linkedin.com/v1/people/~
        public static void RequestAuthorization(WebConsumer consumer)
        {
            if (consumer == null)
            {
                throw new ArgumentNullException("consumer");
            }
            Uri callback = HttpRequestExtensions.GetUrlRewriter(HttpContext.Current.Request.Headers, Util.GetCallbackUrlFromContext().StripQueryArgumentsWithPrefix("oauth_"));
            var request  = consumer.PrepareRequestUserAuthorization(callback, null, null);

            consumer.Channel.Send(request);
        }