Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Access TFS Rest API but i get "Unauthorized" issue

$
0
0

Hi All,

 public class BasicAuthenticationFilter : IHttpRequestHeaderFilter
    {
        private string _authToken;

        public BasicAuthenticationFilter(NetworkCredential userCredential)
        {
            _authToken = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}:{2}",userCredential.UserName, userCredential.Password,
userCredential.Domain
)));
        }

        public HttpRequestHeaders ProcessHeaders(HttpRequestHeaders headers)
        {
            headers.Authorization = new AuthenticationHeaderValue("Basic", _authToken);
            return headers;
        }
    }

Code like this:new NetworkCredential("myuseranme", "mypwd", "mydomain")

I need to access TFS rest API. But i still geting the issue when i request the uri and set httpclilent heads value:

“You do not have permission to view this directory or page using the credentials that you supplied.”

anybody know this? thanks

Code:

https://vsorest.codeplex.com/discussions/587525


True mastery of any skill takes a lifetime.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>