Questions tagged [basic-authentication]

Basic authentication is a method for a web browser or other client program to provide a user name and password when making a request.

Basic authentication was introduced with RFC1945 (HTTP/1.0) and is historically the first mechanism for authenticating at the HTTP layer level. Relying on base64 encoding, it is considered from the beginning as weak and unsecure, but it has a legitimate use on trusted connections (either on encrypted tunnels such as SSL, or unencrypted on a closed network).

Mechanism description :

When challenged by an HTTP server sending a WWW-Authenticate header with a realm challenge, the HTTP client must send a new request including an Authorization header containing the user's credentials encoded in base64.

The user credentials can be stored on the HTTP server itself, or on a remote system such as LDAP.

3320 questions
56
votes
3 answers

What is the cleanest way to do HTTP POST with basic auth in Python?

What is the cleanest way to do HTTP POST with Basic Auth in Python? Using only the Python core libs.
esamatti
  • 18,293
  • 11
  • 75
  • 82
54
votes
10 answers

Preemptive Basic authentication with Apache HttpClient 4

Is there an easier way to setup the http client for preemptive basic authentication than what described here? In previous version (3.x) it used to be a simple method call (eg, httpClient.getParams().setAuthenticationPreemptive(true)). The main thing…
yossis
  • 1,243
  • 2
  • 11
  • 11
53
votes
7 answers

Basic HTTP authentication in Node.JS?

I'm trying to write a REST-API server with NodeJS like the one used by Joyent, and everything is ok except I can't verify a normal user's authentication. If I jump to a terminal and do curl -u username:password localhost:8000 -X GET, I can't get the…
João Pinto Jerónimo
  • 9,586
  • 15
  • 62
  • 86
53
votes
1 answer

How to add basic authentication header to WebRequest

I have a basic WCF service and I want to test it using HttpWebRequest. The problem is that I use basic authentication. How do I add a header with basic authentication? That's my code so far: var request =…
user4041873
50
votes
2 answers

Does securing a REST application with a JWT and Basic authentication make sense?

I have a Spring REST application which at first was secured with Basic authentication. Then I added a login controller that creates a JWT JSON Web Token which is used in subsequent requests. Could I move the following code out of the login…
Stephane
  • 11,836
  • 25
  • 112
  • 175
50
votes
1 answer

HTTP Spec: Proxy-Authorization and Authorization headers

So I'm trying to implement the following scenario: An application is protected by Basic Authentication. Let's say it is hosted on app.com An HTTP proxy, in front of the application, requires authentication as well. It is hosted on proxy.com The…
49
votes
4 answers

Setting up HTTP Basic Authentication for all requests

Is there a way to set up HTTP Basic Authentication for all requests in a SoapUI project? I know it can be done for all requests within a TestSuite but I cant figure out how to do it for all requests in all TestSuites.
DisscCoder
  • 569
  • 1
  • 4
  • 7
49
votes
3 answers

Calling a rest api with username and password - how to

I am new to rest api's and calling them via .NET I have an api: https://sub.domain.com/api/operations?param=value¶m2=value The notes for the api say that to authorize I need to use the basic access authentication - how do I do that? I currently…
andrewb
  • 2,995
  • 7
  • 54
  • 95
48
votes
7 answers

Proxy Basic Authentication in C#: HTTP 407 error

I am working with a proxy that requires authentication, i.e., in a browser if I try to open a page it will immediately ask for credentials. I supplied same credentials in my program but it fails with HTTP 407 error. Here is my code: HttpWebRequest…
rplusg
  • 3,418
  • 6
  • 34
  • 49
47
votes
2 answers

How to use UrlFetchApp with credentials? Google Scripts

I am trying to use Google Scripts UrlFetchApp to access a website with a basic username and password. As soon as I connect to the site a popup appears that requires authentication. I know the Login and Password, however I do not know how to pass…
43
votes
6 answers

Preemptive Basic Auth with HttpUrlConnection?

What is the best way to use preemptive basic http authentication using HttpUrlConnection. (Assume for now I can't use HttpClient). EDIT for clarification: I'm setting the un/pw correctly in the request header using Base64 encoding. Are there any…
Dave Sims
  • 5,060
  • 3
  • 24
  • 26
42
votes
7 answers

Why doesn't the browser reuse the authorization headers after an authenticated XMLHttpRequest?

I'm developing Single Page App using Angular. The backend exposes REST services that require Basic authentication. Getting index.html or any of the scripts does not require authentication. I have an odd situation where one of my view has a
42
votes
3 answers

How to get password from HTTP basic authentication

I'm using HTTP BASIC Authentication with Java. My Servlet sends a JMS message but I need to supply the user and password to authenticate myself while creating the connection: javax.jms.ConnectionFactory.createConnection(String username, String…
Jin Kim
  • 16,562
  • 18
  • 60
  • 86
40
votes
8 answers

How to perform Basic Authentication for FirefoxDriver, ChromeDriver and IEdriver in Selenium WebDriver?

I am using the Selenium-Firefox-driver and Selenium-Chrome-Driver version 2.0a5 (Web Driver API), and I am trying to test a web app that has BASIC authentication (there is a popup that come up to authenticate the user when I hit whatever page, the…
39
votes
5 answers

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/Anonymous.aspx, authentication popup…