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.
http-status-code-401
1,126
questions
3586
votes
22
answers
1.5m
views
403 Forbidden vs 401 Unauthorized HTTP responses
For a web page that exists, but for which a user does not have sufficient privileges (they are not logged in or do not belong to the proper user group), what is the proper HTTP response to serve?
401 ...
96
votes
6
answers
238k
views
How to handle 401 (Authentication Error) in axios and react?
I have one file request.js which contains wrapper for axios ajax request. I am calling request function from multiple react components and when one of the request fails I want to refresh the token and ...
93
votes
19
answers
248k
views
401 Unauthorized: Access is denied due to invalid credentials
I am using IIS Express to deploy MVC4 application. This website runs perfectly on same computer. But in Lan it gives me error 401.
<authentication mode="Forms">
<forms loginUrl="~/" ...
85
votes
9
answers
202k
views
How do I get the HTTP status code with jQuery?
I want to check if a page returns the status code 401. Is this possible?
Here is my try, but it only returns 0.
$.ajax({
url: "http://my-ip/test/test.php",
data: {},
complete: function(...
75
votes
9
answers
114k
views
Unable to get windows authentication to work through local IIS
So I've created a new ASP.NET MVC project using the intranet template. web.config contains the appropriate values (e.g. <authentication mode="windows"/>).
If I fire up the web app using the VS ...
60
votes
2
answers
5k
views
View Vimeo private video with an OAuth token
Can anyone give a help in Vimeo API using scribe? My goal is to access a private video (which I uploaded) without having to force the user to put password (this process should be done in background).
...
59
votes
7
answers
56k
views
Is it possible to send a 401 Unauthorized AND redirect (with a Location)?
I'd like to send a 401 Unauthorized AND redirect the client somewhere. However:
if I do it like this:
header('HTTP/1.1 401 Unauthorized');
header('Location: /');
the server sends a 302 Found with ...
53
votes
1
answer
2k
views
Intermittent 401 Unauthorized from Google GCM
We are getting intermittent 401 Unauthorized errors from Google's GCM service. In the past, it worked 100% of the time. The problem might coincide with our routers accepting IPv6 traffic, but the ...
43
votes
2
answers
38k
views
Authorization in RESTful HTTP API, 401 WWW-Authenticate
I'm creating a RESTful service to provide data to a web application. I have two related questions about this.
1. How to deal with unauthorized requests?
I'm intending to respond to requests with the ...
39
votes
5
answers
177k
views
HTTP Error 401.2 - Unauthorized You are not authorized to view this page due to invalid authentication headers
i want to allow access to Anonymous.aspx page to all user,
i have set Basic Authentication to Enabled, and Connect as to specific user.
my problem is when trying to access http://MyIPAddress/MyAlias/...
37
votes
3
answers
49k
views
401 Unauthorized vs 403 Forbidden: Which is the right status code for when the user has not logged in? [duplicate]
After lots of Googling and Stackoverflowing, it still isn't clear to me because many articles and questions/answers were too general (including 403 Forbidden vs 401 Unauthorized HTTP responses which ...
37
votes
13
answers
78k
views
GCM http 401 authorization error
When my backend server sends post requests to GCM servers I get an authorization error HTTP 401.
I followed the steps described here:
http://developer.android.com/google/gcm/http.html#auth_error
&...
31
votes
5
answers
56k
views
Spring RestTemplate invoking webservice with errors and analyze status code
I designed a webservice to perform a task if request parameters are OK, or return 401 Unauthorized HTTP status code if request parameters are wrong or empty.
I'm using RestTemplate to perform a test ...
28
votes
4
answers
14k
views
Ruby-on-Rails: How to get rid of "you are being redirected" page
I am overriding Devise's failure response so that I can set a 401 status code. However, when the user fails to sign in, they are redirected to a page with a "you are being redirected" link. If I ...
28
votes
3
answers
64k
views
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:
...
28
votes
1
answer
32k
views
Angular.js $http.post TypeError: Cannot read property 'data' of undefined
Angular.js v1.0.6
When making an $http.post and receiving a non 200 resposne (401 in this case)
$http.post('http://localhost:3030/auth/login', {
username: 'username',
password: 'password'
})
....
28
votes
7
answers
50k
views
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).
...
26
votes
5
answers
20k
views
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). ...
24
votes
1
answer
4k
views
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 ...
23
votes
2
answers
23k
views
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 ...
22
votes
5
answers
44k
views
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 ...
21
votes
2
answers
2k
views
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 ...
20
votes
4
answers
16k
views
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] ...
19
votes
7
answers
96k
views
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 --...
18
votes
5
answers
16k
views
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 ...
18
votes
2
answers
139k
views
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 = ...
18
votes
3
answers
23k
views
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 ...
16
votes
7
answers
31k
views
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 ...
16
votes
1
answer
776
views
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 ...
15
votes
5
answers
75k
views
The request failed with HTTP status 401: Unauthorized
I have a .NET 2.0 website (VB) running in my IIS6 (XP Pro SP2) and a .NET 3.5 (configured as .NET2 under IIS's ASP.NET tab, of course) hosting an ASMX web service.
In Chrome, I can call the ASMX and ...
15
votes
2
answers
9k
views
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(...
14
votes
5
answers
10k
views
Using RoboSpice is there a way to get the HTTP Error Code out of an exception?
I am writing an application that uses RoboSpice. In the request listener onRequestFailure( SpiceException arg0 ) is there a way to know for sure that the error was a result of a 401 HTTP Error ...
13
votes
3
answers
15k
views
'Login as another user' MVC 4 Windows Authentication
I have an intranet project written in MVC 4 which uses Windows Authentication to authorise and authenticate users.
I need to add a 'Login as another user' functionality.
After some searching I found ...
13
votes
2
answers
13k
views
Handling Authentication in Okhttp
I'm using OkHttp 2.3 with basic authentication requests, according to OKHttp docs, it automatically retries unauthenticated requests, but whenever I provide invalid credentials, the request takes too ...
13
votes
1
answer
38k
views
Setting authorization header in axios
I have been trying to make a GET request to the National Park Service API with axios and have tried several ways to set my API key in the request header to no avail. Any assistance will be greatly ...
12
votes
3
answers
57k
views
The remote server returned an error: (401) Unauthorized
I'm trying to get the html code of certain webpage,
I have a username and a password that are correct but i still can't get it to work,
this is my code:
private void buttondownloadfile_Click(object ...
12
votes
3
answers
20k
views
Access Exchange Web Services with PHP and cURL
Hello,
I am currently writing a client to access a Microsoft Exchange server and read contacts, appointments etc. from it.
Through days of searching I've been able to connect to the EWS via PHP's ...
12
votes
2
answers
9k
views
Get rid of a 401 (unauthorized) ajax error in browser console
I'm calling an api through javascript using a jQuery.ajax call. The api respond with 401 if the user is not authenticated and I want to ignore this error only for this call.
I've tried all the ...
11
votes
2
answers
16k
views
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<String, String> responseHeaders = new HashMap<>();
int ...
11
votes
1
answer
29k
views
Catch 401 Exception in Angular2
When i try to connect to an unauthorized URL i get in Chrome:
zone.js:1274 POST http://localhost:8080/rest/v1/runs 401 (Unauthorized)
core.umd.js:3462 EXCEPTION: Response with status: 401 ...
11
votes
3
answers
8k
views
Service-Worker, "TypeError:Request failed at <anonymous>"
I hope you can help me with my problem.
Currently I build a PWA with a service-worker. It registerd successful, but something is wrong with the installation.
The "caches.open"-promise result in an ...
11
votes
2
answers
4k
views
Android: HttpsUrlConnection with Authenticator for Basic Authentication iterates forever when password is wrong (on 401 response)
I am using an HttpsUrlConnection with Basic Authentication by using an Authenticator and setting a default Authenticator object like this:
Authenticator.setDefault(new Authenticator() {
protected ...
10
votes
3
answers
51k
views
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....
10
votes
4
answers
13k
views
strange 401 error appears for some urls when using .htaccess to redirect http to https
OK, here is the 7th day of unsuccessfull attempt to find an answer why 401 error appears...
Now,
.htaccess in the root folder contains the only 3 strings (was simplified) and there are NO more ....
10
votes
2
answers
12k
views
WCF REST Service - 401 Unauthorized
We're in the process of developing a WCF REST web service which just receives a bunch of arbitrary text from any anonymous user and then performs some processing on the back end.
For example, here's ...
10
votes
5
answers
6k
views
Why does toaster service inside Global Error Handler wont work in Angular4/5/6?
My requirement is to load some data by calling Two Rest Api's before app component loads.If API gives any error display the message in Toaster (angular2-toaster).
Before loading app component the ...
10
votes
1
answer
4k
views
Chrome: Basic Auth image requests return 401, but not when called directly
Chrome throws 401 restricted errors for Basic auth'd IMG-urls in the vein of http://user:[email protected]/image, but did not do this before with the same resources and code. When called directly, as in "...
9
votes
4
answers
16k
views
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 ...
9
votes
1
answer
24k
views
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 ...
9
votes
4
answers
56k
views
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 ...