I am using nodejs 0.4.1 with Connect and [connect-auth](https://github.com/ciaranj/connect-auth) 0.3.0 for authentifications.
When I login using any strategy I am doing a redirect. 

The problem is that I am getting this error when writing headers for redirect (302): "Can't render headers after they are sent to the client.". It seems the headers have already been written. 

```
req.authenticate(['google'], function(error, authenticated) 
        {
            if(error)
            {
                res.writeHead(302, {'Location': "/" + result.userName});
                res.end();
                return;
            }
            else if( authenticated === undefined)
            {
                return;
            }
            else if( authenticated ) 
            {
                sys.log("Authenticated from google " + util.inspect(req.getAuthDetails()));
                req.session.from = "google";
                RegisterOrLogin(...., function(result)
                {
                    if(result.error == false)//logged in successfuly
                    {//redirect
                        res.writeHead(302, {'Location': "/" + result.userName});
                        res.end();
                    }
                    else//could not log in
                    {
                        res.writeHead(302, {'Location': '/'});
                        res.end();
                    }
                });
                return;
            }
        });

```

Do you know of any workaround for this? 

Thank you.