Ejemplo n.º 1
0
         public CallbackResult ParseAccessToken(string url)
         {
             var callbackUrl = new Api.UrlHelper.UrlHelperFactory().GetUrlDetails().CallbackUrl;

             if (url.StartsWith(callbackUrl, StringComparison.InvariantCultureIgnoreCase))
             {
                 var trailing = url.Substring(url.IndexOf(callbackUrl, StringComparison.InvariantCultureIgnoreCase) + callbackUrl.Length);
                 var toFilter = ContainsAccessToken(trailing);

                 if (!string.IsNullOrEmpty(toFilter))
                 {
                     var token = trailing.Substring(trailing.IndexOf(toFilter, StringComparison.InvariantCultureIgnoreCase) + toFilter.Length);

                     return new CallbackResult {Status = CallbackStatus.Success, Token = token};
                 }
             }

             return new CallbackResult {Status = CallbackStatus.Failed}; 
         }
Ejemplo n.º 2
0
        public CallbackResult ParseAccessToken(string url)
        {
            var callbackUrl = new Api.UrlHelper.UrlHelperFactory().GetUrlDetails().CallbackUrl;

            if (url.StartsWith(callbackUrl, StringComparison.InvariantCultureIgnoreCase))
            {
                var trailing = url.Substring(url.IndexOf(callbackUrl, StringComparison.InvariantCultureIgnoreCase) + callbackUrl.Length);
                var toFilter = ContainsAccessToken(trailing);

                if (!string.IsNullOrEmpty(toFilter))
                {
                    var token = trailing.Substring(trailing.IndexOf(toFilter, StringComparison.InvariantCultureIgnoreCase) + toFilter.Length);

                    return(new CallbackResult {
                        Status = CallbackStatus.Success, Token = token
                    });
                }
            }

            return(new CallbackResult {
                Status = CallbackStatus.Failed
            });
        }