Basic Auth does not use cookies. After you provide the credentials, its
up to the browser to stop sending the Authentication header. Usually
that happens after a browser restart. Try private browsing.

danmilon.

On 10/25/2012 04:16 PM, gng wrote:
> Sorry, I should have been more specific: I have removed cookies (even
> restarted the browser) but I do not get challenged again.
> 
> Is there anything that I'm missing ? The way I understand things is that
> on clearing any set cookies, you should be challenged each time the page
> is next visited.
> 
> On Thursday, 25 October 2012 14:07:28 UTC+1, greelgorke wrote:
> 
>     check your cookies. flushing cache has no effect on cookies.
> 
>     Am Donnerstag, 25. Oktober 2012 14:31:53 UTC+2 schrieb gng:
> 
>         Thanks. I added that so my code now looks like :-
> 
>         var express = require('express');
> 
>         var server = express.createServer();
> 
>         server.use(express.basicAuth('test','testpass'));
> 
>         io = require('socket.io <http://socket.io>').listen(server);
>         io.set('log level', 1); // reduce logging
> 
>         server.use(express.static(__dirname + '/public'));
>         server.use(express.basicAuth(function(user,pass){
>                 return 'test'==user & 'testpass' == pass;
>                 }));
> 
> 
>         server.listen(80);
> 
> 
>         On starting the server and first accessing a page, there is
>         indeed a prompt for a username and password. If that's supplied,
>         the page is then rendered. However, on restarting and visiting
>         the page, no prompt is made (browser cache is flushed etc) - is
>         there a way to overcome that ?
> 
>         On Thursday, 25 October 2012 12:44:49 UTC+1, greelgorke wrote:
> 
>             http://expressjs.com/api.html#basicAuth
>             <http://expressjs.com/api.html#basicAuth>
> 
>             Am Donnerstag, 25. Oktober 2012 11:23:08 UTC+2 schrieb gng:
> 
>                 Hi,
> 
>                 Can anyone provide some sample code to show how a node
>                 http server can be secured using basic username/password
>                 authentication. Here's my sample server :-
> 
>                 var express = require('express');
>                 var server = express.createServer();
> 
>                 server.use(express.static(__dirname + '/public'));
>                 server.listen(80);
> 
>                 I've seen packages such as http-auth etc ...
> 
>                 Thanks in advance !
> 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to