http-status-code-401

Using RoboSpice is there a way to get the HTTP Error Code out of an exception?

我与影子孤独终老i 提交于 2019-12-02 17:18:11
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 occurred? I have a back end service, that returns a 401 error when a token expires, when that occurs I need to prompt the user to re-enter their credentials. Is there anyway to know that a 401 HTTP error specifically occurred? Below is an example of my request. public class LookupRequest extends SpringAndroidSpiceRequest <Product> { public String searchText; public String searchMode; public LookupRequest

How to handle 401 (Authentication Error) in axios and react?

醉酒当歌 提交于 2019-12-02 16:24:43
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 retry all the failed requests again. I can use intercepters, but I don't know how to implement it. Please help. request.js var client = axios.create({ baseURL: 'http://192.168.1.3:3000', headers: { appID: 8, version: "1.1.0", empID: localStorage.getItem('empID'), token: localStorage.getItem('accessToken') } }); const request = function(options) { const onSuccess = function(response) { console

Azure DocumentDB Intermittent 401 error when querying REST API via Obj-c

时间秒杀一切 提交于 2019-12-02 11:11:48
I've been charged with implementing an objective-c based iOS query of the Azure DocumentDB system using the REST API scheme. Utilizing the code found on github, specifically https://github.com/Azure/azure-storage-ios I was able to generate a request that appropriately authenticates and returns the appropriate data.... sometimes. The problem: I receive a 401 (authentication failure) error response from the server intermittently. Making the same request via Node.js does not encounter this behavior, so I believe this to be an issue with my objective-c implementation. - (NSMutableURLRequest *)

PUT and DELETE in RESTful WCF Service cause 401 Unauthorized error

若如初见. 提交于 2019-12-02 03:28:56
问题 I have a RESTful web service in IIS 7.5 that is working just fine in our Development environment. Now we have deployed to a QA environment and we are getting 401 errors only on the PUT and DELETE verbs. I have read a lot about 405 errors, but not much about 401 errors. Here is the exact error message whenever I attempt a PUT or a DELETE. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was '' Does anyone have

file_get_contents HTTP request failed

二次信任 提交于 2019-12-01 20:16:26
I written simple php code to get some url content but it dosn't work it return this error file_get_contents( http://www.nature.com/nature/journal/v508/n7496/full/nature13001.html ) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized here is my code. please help me.tnx $content=file_get_contents('http://www.nature.com/nature/journal/v508/n7496/full/nature13001.html'); echo $content; Here's an alternative to file_get_contents using cURL : $url = 'http://www.example.com'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl,

How to display HTTP 401 basic authentication dialog

被刻印的时光 ゝ 提交于 2019-12-01 11:41:21
I am new to web development. I have Android application that hosts some web pages using HTTPServer. I am using Netty to decode/encode request/responses. Now, I want to display basic authentication dialog when someone navigates to the my webpage. Something like this: Can I get some pointers ? Is it something HTTP built in functionality, any RFC ? Do I need to write some java script ? Any help would be great. You just need to send the appropriate headers when a client requests a resource you want to require authentication for. HTTP/1.1 401 Unauthorized WWW-Authenticate: Basic realm="Restricted

The remote server returned an error: (401) Unauthorized

本秂侑毒 提交于 2019-12-01 03:16:22
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 sender, EventArgs e) { NetworkCredentials nc = new NetworkCredentials("?", "?", "http://cdrs.globalpopsvoip.com/0000069/20091229/20091228_20091228.CDR"); WebClient client = new WebClient(); client.Credentials = nc; String htmlCode = client.DownloadString("http://cdrs.globalpopsvoip.com/0000069/20091229/20091228_20091228.CDR"); MessageBox.Show(htmlCode); } The MessageBox is just to test it, the

Getting “401 Unauthorized” error consistently with jquery call to webmethod

谁说胖子不能爱 提交于 2019-12-01 01:14:28
问题 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 call. Your insight is appreciated! Call to js function the invokes the jquery call button.OnClickAction = "PageMethod('TestWithParams', ['a', 'value', 'b', 2], 'AjaxSucceeded', 'AjaxFailed'); return false;"; JavaScript function that makes the jquery

The remote server returned an error: (401) Unauthorized

别说谁变了你拦得住时间么 提交于 2019-11-30 23:47:14
问题 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 sender, EventArgs e) { NetworkCredentials nc = new NetworkCredentials("?", "?", "http://cdrs.globalpopsvoip.com/0000069/20091229/20091228_20091228.CDR"); WebClient client = new WebClient(); client.Credentials = nc; String htmlCode = client.DownloadString("http://cdrs.globalpopsvoip.com/0000069

Ruby-on-Rails: How to get rid of “you are being redirected” page

一笑奈何 提交于 2019-11-30 17:15:30
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 remove this :status => 401 from the redirect it works fine. class CustomFailure < Devise::FailureApp def redirect_url new_user_session_url(:subdomain => 'secure') end def respond if http_auth? http_auth else store_location! flash[:alert] = i18n_message unless flash[:notice] redirect_to redirect_url, :status => 401 end end end edit Alternatively I would like to display the flash message and remain on