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
2
votes
1 answer

How to Access Password/SSL Secured Content through YQL and Yahoo Pipes

The content is secured through basic HTTP authentication: you try to access the URL, you're prompted for user pass by your browser, fill submit, and bam you've gotten the resource. These steps can all be condensed by making a request as follows in a…
fny
  • 31,255
  • 16
  • 96
  • 127
2
votes
2 answers

Calling webservice in C# using SSL - '(401) Unauthorized'

I'm calling a method on a web service from behind a proxy server using the following code: myWebService.TestWebService webservice = new myWebService.TestWebService(); webservice.Url = "http://test.com/webservice?wsdl"; WebProxy proxy = new…
Chris B
  • 5,311
  • 11
  • 45
  • 57
2
votes
1 answer

How can I know I got the 401 error when fetch data?

I use async function to fetch data, How can I know I got the 401 error when fetch data? code like this: async function getBilling(url, id, date) { let header = { method: 'GET', headers: { …
MOLLY
  • 409
  • 2
  • 12
2
votes
1 answer

Returning 401 or 403 to browser

We are modifying code that displays in response to a Server sending either a 401 or a 403 error. export const handleStatusCodeMessage = (errorStatusCode, verbiageConfig, errorStatusMessage) => { let {errorType, errorMessage} = ''; switch…
2
votes
2 answers

Why do I get a 401 unauthorized error when logging in?

I am using the NextAuth.js credentials provider for the log in procedure. When logging in I am catching the errors in a try-catch block and set the error state accordingly, but I do not display the error state anywhere yet. Even though I am catching…
2
votes
1 answer

Another Google Apps Script UrlFetchApp returning Unauthorized Error 401

So, I am using a Google Spreadsheet which holds protected ranges, therefore, to accomplish sorting rows, an unbound web app is invoked from the sheet: Google Sheet XYZ -> Unbound Web App (sort code) -> Google Sheet XYZ Unbound Web App runs under…
2
votes
1 answer

Error The remote server returned an error: (401) Unauthorized

I am trying to get emails from my shared outlook exchange inbox, but unfortunately it is not working because of this error: The request failed. The remote server returned an error: (401) Unauthorized This is the code I am currently using. It is…
Rekcs
  • 869
  • 1
  • 7
  • 23
2
votes
1 answer

Spring Boot no default 401 JSON response on latest version but works on older

Spring Boot version 2.6.3 appears to no longer send the default JSON responses with 401 codes and some others responses. @Override public void commence(HttpServletRequest httpServletRequest, HttpServletResponse…
Shahar
  • 23
  • 1
  • 5
2
votes
2 answers

How to prevent user to access css files and images via the url

I am using .htaccess to prevent user to access files through url. The line RewriteRule ^frontend/assets/css/(.+) index [L,R] works fine. It prevents users to access css files. However, RewriteRule ^frontend/assets/images/(.+) index [L,R]…
Kyv
  • 615
  • 6
  • 26
2
votes
1 answer

Prevent 401 error browser console angular

I have this problem, i have implemented a JWT token with refresh token options when the JWT token expire. When the token expires my serverless backend return a 401 and in this case with my angular interceptor i'll call the http API for refresh my…
Reiuz
  • 63
  • 3
2
votes
5 answers

Why does a request to an undefined route result in 401 unauthenticated in Laravel

A Laravel 8 application with Sanctum. When I send a request to a defined route using Postman with an access token the response is correct. I'm happy with this. When I send a request to a defined route using Postman without an access token the…
cja
  • 9,512
  • 21
  • 75
  • 129
2
votes
0 answers

Why route throws 401 when Cypress test clicks on link but it is OK when tested manually?

I'm aware this sounds like a back-end issue at first but I suspect Cypress causing this route to throw 401 for some reason. When I test logout route manually it gives me 200 status code back and UI changes accordingly. However when Cypress tests the…
Mark
  • 1,385
  • 3
  • 16
  • 29
2
votes
1 answer

Securing ASP.Net Core Web API and Angular App using MSAL

I have an ASP.NET core web application with Angular as front end. I have a web API created in my application which I can invoke from angular app. I wanted to protect both my Web API and Angular client app using MSAL. I managed to get MASL working…
2
votes
1 answer

Issue accessing RapidAPI with httr / R - Status: 401

I am trying to access a RapidAPI with the httr package in R as follows: library(httr) url <- "https://extract-news.p.rapidapi.com/v0/article" queryString <- list(url =…
seb-29
  • 51
  • 2
2
votes
1 answer

HTTP method’s error: 401 (Unauthorized) on React & Django(DRF)

I completed manipulating authentication with token by referring this article, and then I’m trying to create a crud function such creating post, displaying posts, etc… . However, I have an error when I fetched the url which displays posts(IE,…