Questions tagged [http-status-code-401]

Similar to 403 Forbidden, but specifically for use when authentication is possible but has failed or not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource.

The request has not been applied because it lacks valid authentication credentials for the target resource.

The server generating a 401 response MUST send a WWW-Authenticate header field1 containing at least one challenge applicable to the target resource.

If the request included authentication credentials, then the 401 response indicates that authorization has been refused for those credentials. The user agent MAY repeat the request with a new or replaced Authorization header field2. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user agent SHOULD present the enclosed representation to the user, since it usually contains relevant diagnostic information.

See

1109 questions
28
votes
3 answers

Exchange Web Service API and 401 unauthorized exception

When I try sending email using the EWS API, I get the following error: (in message.Send();) The request failed. The remote server returned an error: (401) Unauthorized. My code is the following: ExchangeService exchangeService = new…
28
votes
7 answers

Avoiding 401 response for each request using NTLM

We have here an asp.net 3.5 application using NTLM based windows authentication. The system runs on a private network that actually distributed over different geographic places (connected via VPN). We are now trying to optimize the website's…
Satumba
  • 880
  • 1
  • 10
  • 21
26
votes
5 answers

Eradicating 401 "Unauthorised" responses followed by 200 "Ok" responses

I’ve got a situation with a large internal corporate web based application running ASP.NET 3.5 on IIS6 generating 401 “Unauthorised” responses followed by 200 “Ok” responses (as profiled by Fiddler). I’m aware of why this happening (integrated auth…
Troy Hunt
  • 20,345
  • 13
  • 96
  • 151
24
votes
1 answer

401 when accessing Dynamics CRM 2016 Web APIs

I am struggling to access the Dynamics 2016 CRM OData Web APIs from a console application. We have Dynamics CRM 2016 installed, configured with Claims-based authentication, and using AD FS v3.0. My understanding is that a console app (or web app)…
tsimbalar
  • 5,790
  • 6
  • 37
  • 61
23
votes
2 answers

AngularJS - Handling refresh token?

I'm building a SPA with AngularJS with communication to a service (JAVA). When user sends his username/pass, service sends back both: Acces token and Refresh token. I'm trying to handle: if I get response with status 401, send back refresh token and…
21
votes
2 answers

github issues api 401, why? (django)

I'm trying to integrate github issues api into a project. I think I'm following the rules of oauth, and everything that is needed and mentioned on http://develop.github.com/p/issues.html, but it doesn't seem to work. I don't get detailed error…
kecske
  • 649
  • 1
  • 8
  • 19
21
votes
5 answers

Command to rebuild applicationHost.config in IIS 7

Is there a way to rebuild the applicationHost.config file in IIS 7 with a Windows command? Or if you can help me fix the issue by modifying this file, that's fine too. When comparing this file to other servers, I'm noticing very important sections…
20
votes
4 answers

Unauthorized result in ajax requests

I have application with many ajax actions (implemented using JQuery.ajax), that returns JSON ot html. Some of them should be accessible only to authorized users, and I decorated them with [Authorize] attribute. For not ajax actions, if user not…
19
votes
7 answers

WGET 401 Unauthorized

I'm trying to use a batch file with WGET to download the public FCC file from here http://wireless.fcc.gov/uls/data/complete/l_micro.zip When I intially run the batch file with parameters wget --server-response -owget.log…
user1192537
  • 193
  • 1
  • 1
  • 4
18
votes
5 answers

401 instead of 403 with Spring Boot 2

With Spring Boot 1.5.6.RELEASE I was able to send HTTP Status code 401 instead of 403 as described in How let spring security response unauthorized(http 401 code) if requesting uri without authentication, by doing this: public class SecurityConfig…
18
votes
3 answers

Chaining Express.js 4's res.status(401) to a redirect

I'd like to send a response code of 401 if the requesting user is not authenticated, but I'd also like to redirect when the request was an HTML request. I've been finding that Express 4 doesn't allow this: res.status(401).redirect('/login') Does…
brock
  • 2,302
  • 7
  • 27
  • 30
18
votes
2 answers

Server returned HTTP response code: 401 for URL: https

I'm using Java to access a HTTPS site which returns the display in an XML format. I pass the login credentials in the URL itself. Here is the code snippet: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db =…
Vish
  • 193
  • 1
  • 1
  • 5
16
votes
7 answers

Turning off ASP.Net WebForms authentication for one sub-directory

I have a large enterprise application containing both WebForms and MVC pages. It has existing authentication and authorisation settings that I don't want to change. The WebForms authentication is configured in the web.config:
Keith
  • 150,284
  • 78
  • 298
  • 434
16
votes
1 answer

401 when calling Web Service only on particular machines

We have developed a WPF Application with C# and are using RestSharp to communicate with a simple Web Service like this: Client = new RestClient(serviceUri.AbsoluteUri); Client.Authenticator = new NtlmAuthenticator(SvcUserName,…
hoetz
  • 2,368
  • 4
  • 26
  • 58
15
votes
2 answers

How to prevent IIS7 for handling HTTP status code 401?

I'm working my ASP.NET MVC 2 project. I create exception filter for catching unauthorized access exception that occur when user does not has permission to view some action. [CustomError(typeof(UnauthorizedAccessException), "Error",…
user94893
1
2
3
73 74