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
9
votes
5 answers

ASP.NET MVC 3 Intranet site on IIS7.5 w Windows Authentication gives 401.3 and File authorization failed for the request when trying to log in

I have made an ASP.NET MVC 3 Intranet site with Windows Authentication enabled: in the Visual Studio project file properties in the web.config, i.e. on the site properties in the IIS 7.5. server Anonymous access is…
9
votes
4 answers

What WWW-Authenticate header should a http server return in a 401 response when using form-based authentication?

I have a web application with a Javascript part running on the browser. That frontend uses several HTTP endpoints (more or less REST). The frontend must be able to distinguish between 401 and 403 responses and must not receive the 3xx redirects…
Gustave
  • 3,359
  • 4
  • 31
  • 64
9
votes
1 answer

jquery $.ajax call results in 401 unauthorized response when in Chrome or Firefox, but works in IE

I have a script running on a web page that needs to use the JQuery $.ajax method (currently using jquery 1.7.2) to submit several GET requests to a service endpoint on a different domain. I have the ajax call working in IE (9, 10, 11), but it fails…
AK3800
  • 2,138
  • 3
  • 23
  • 28
9
votes
1 answer

401 error while using tweepy

I am running the below program.But am getting the below error Message. 401 **** 401 **** (keeps on repeating) The code(got from some forum) basically tries to connect to Twitter and fetch tweets. When its ran on ubuntu terminal the 401 error message…
subin alex
  • 149
  • 2
  • 9
9
votes
2 answers

Java HttpURLConnection.getInputStream but get 401 IOException

I am writing a REST client for CouchDB in Java. The following code should be quite standard: this.httpCnt.connect(); Map responseHeaders = new HashMap<>(); int i = 1; while (true){ String headerKey =…
9
votes
4 answers

The remote server returned an error: (401) Unauthorized. Using CSOM in ASP.NET

I'm tried to pull some SharePoint 2013 list data I created which works fine when running locally on my machine and when run locally one the server. I'm user the same credentials when running both locally and locally on the server. The issue is…
Hidan
  • 347
  • 1
  • 5
  • 18
9
votes
4 answers

customerrors for 401.2 in ASP.NET

I successfully implemented role based authorization in ASP.NET. When a person does not have the needed role he gets to see an error page for 401.2 not authorized. What I would like to accomplish now is to have a custom 401 page in my application…
Nyla Pareska
  • 1,377
  • 6
  • 22
  • 37
9
votes
1 answer

HTTP Status Code: 401 in GCMDemo

Reference:http://developer.android.com/google/gcm/demo.html Server 401 when trying to send a message to my android device. HTTP Status 500 - HTTP Status Code: 401 type Exception report message HTTP Status Code: 401 description The server…
Nic
  • 113
  • 1
  • 1
  • 7
8
votes
5 answers

Asp.net Images are giving 401 unauthorized error randomly

I am using Asp.net, IIS 6 and cdn for serving images. I am having a problem with loading the images in my website. images are under a virtual folder. Everytime I hit refresh of the browser, some of the images gives 401 unauthorized error. (images…
Artex
  • 155
  • 1
  • 6
8
votes
4 answers

Laravel 5.4 + Ajax equals 401 Unauthenticated

Whenever I try to assign a route from my api.php File I get a 401: Unauthenticated-Error. This is the route: Route::group(['prefix' => 'v1', 'middleware' => 'auth:api'], function () { Route::post('admin/product-image-sort',…
user3993570
8
votes
3 answers

Getting "401 Unauthorized" error consistently with jquery call to webmethod

I have been struggling to get my jquery call to a webmethod to work. I am being bounced by the server with a "401 Unauthorized" response. I must have an incorrect setting in the web.config or somewhere else that would be preventing a successful…
8
votes
3 answers

getting error java.io.IOException: Server returned HTTP response code: 401 for

Iam trying to authenticate to https url , but iam getting exception . Below is code. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import…
developer
  • 9,116
  • 29
  • 91
  • 150
7
votes
1 answer

Chrome ignores HTTP WWW-Authenticate realm

Our web application has user/password authentication. It runs on a web server which is secured itself with HTTP Basic Auth. This is just a temporary solution / workaround. The web application's authentication will be sufficient in future, but at the…
7
votes
1 answer

Setting authentication header for WebBrowser control - ASP.NET

I'm using WebBrowser control in my asp.net application to generate screenshots of web pages. I was able to generate images till I changed the application pool account. I've given the new application pool all the necessary rights and I'm able to…
NLV
  • 21,141
  • 40
  • 118
  • 183
7
votes
2 answers

When using an API route, return Http Response 401 instead of redirect to login page when not authorised

I'm building an ASP.NET Core 2.0 website using MVC and WebAPI to provide access to a series of microservices. Where a WebAPI controller requires a user to be authenticated and authorised (using the Authorize attribute), any unauthorised or…