jaredhanson/passport-browserid — Issue #1: BrowserId returns to login page without message
Author: scan
Created: 2012-03-05 13:43:46+00:00
State: open

I have tried to implement the BrowserId technique as shown in the examples, but all it does is return to the `/login` page without giving a message. I've suspected it could be a problem with the `connect.csrf` I'm using, but I de-activated it and the problem persists. These are my sources:

```coffee-script
server = "localhost:8080"

passport.use new BrowserIDStrategy audience: "http://#{server}", (email, done) ->
user.findOne 'auth.service': 'browserid', 'auth.id': email, (err, user) ->
if err? then done err
else if user?
users.update { _id: user._id }, { $set: 'last-login': new Date }
done null, user
else
name = email.split('@', 2)[0]
users.insert auth: { id: email, service: 'browserid' }, email: email, name: name, 'created-at': new Date(), 'last-login': new Date(), {safe: yes}, (err, docs) ->
if err? then done err
else done null, docs[0]
```

And the route:

```coffee-script
app.post '/auth/browserid', passport.authenticate('browserid', failureRedirect: '/login'), (req, res) ->
res.redirect '/'
```