http-status-code-401

Angular.js $http.post TypeError: Cannot read property 'data' of undefined

我们两清 提交于 2019-11-27 17:11:22
问题 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' }) .success(function(data) { // Gets called on a 200 response, but not on a 401 console.log('success'); }) .error(function(err) { // Never gets called & dies with error described below. console.log('error'); }); Angular throws the following error: TypeError: Cannot read property 'data' of undefined at http:/

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

时光毁灭记忆、已成空白 提交于 2019-11-27 15:34:37
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 with a 401 Unauthorized response in Firefox and Chrome. Part of the additional error message in Chrome is "Full authentication is required to access this resource". My ajax call is setup like this (dataType is "json" for these requests that fail, and async is true): $.ajax({ url: url, type: "GET", async: isAsync, dataType: dataType, username: user,

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

泄露秘密 提交于 2019-11-27 14:44:14
问题 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: <authentication mode="Forms"> <forms blah... blah... blah /> </authentication> <authorization> <deny users="?" /> </authorization> Fairly standard so far. I have a REST service that is part of this big application and I want to use HTTP authentication instead for this

GCM http 401 authorization error

北城以北 提交于 2019-11-27 11:54:37
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 >> api_key=AIzaSyDEy3... >> curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_id\":\"ABC\"}" I get this: <HTML> <HEAD> <TITLE>Unauthorized</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Unauthorized</H1> <H2>Error 401</H2> </BODY> </HTML> In the troubleshooting it says: Authentication Error The

Unable to get windows authentication to work through local IIS

Deadly 提交于 2019-11-27 09:09:24
问题 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 webserver, it all looks fine - the page shows my Windows domain and username and all. However, this works in Opera and Safari as well as IE and FF, which says to me it's not using Windows auth at all (since to the best of my knowledge this doesn't work in any browser except IE/FF). Next step is to get

Exchange Web Service API and 401 unauthorized exception

断了今生、忘了曾经 提交于 2019-11-27 08:50:51
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 ExchangeService(ExchangeVersion.Exchange2007_SP1); //WebService Uri try { exchangeService.Url = new Uri("https://exchangeserver/ews/exchange.asmx"); } catch (Exception ex) { throw new Exception(string.Format("WebService Uri:" + ex)); } //Credentials try { exchangeService.Credentials = new WebCredentials("user@domain", "pwd", "domain"); } catch (Exception ex) {

401 instead of 403 with Spring Boot 2

五迷三道 提交于 2019-11-27 04:38:02
问题 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 extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { //... http.exceptionHandling() .authenticationEntryPoint(new Http401AuthenticationEntryPoint("myHeader")); //... } } using the org

Exchange Web Service API and 401 unauthorized exception

◇◆丶佛笑我妖孽 提交于 2019-11-27 04:01:45
问题 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 ExchangeService(ExchangeVersion.Exchange2007_SP1); //WebService Uri try { exchangeService.Url = new Uri("https://exchangeserver/ews/exchange.asmx"); } catch (Exception ex) { throw new Exception(string.Format("WebService Uri:" + ex)); } //Credentials try {

'Login as another user' MVC 4 Windows Authentication

こ雲淡風輕ζ 提交于 2019-11-27 00:47:57
问题 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 this solution which suggests returning a 401, and created the following Action (which is called using a form): // // POST: /Home/LogOut [HttpPost] [ValidateAntiForgeryToken] public ActionResult LogOut() { return new HttpUnauthorizedResult(); } The Action gets called, and the browser pops up a

Spring RestTemplate invoking webservice with errors and analyze status code

心不动则不痛 提交于 2019-11-27 00:11:30
问题 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 and I'm able to verify the HTTP 200 OK status if the webservice replies with success. I am however unable to test for HTTP 401 error because RestTemplate itself throws an exception. My test method is @Test public void testUnauthorized() { Map<String, Object> params = new HashMap<String, Object>();