File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ THIS ISN'T REAL, YET.
2+
3+ ## BrowserID Authenticated Sessions for Connect
4+
5+ BrowserID allows you to implement incredibly convenient
6+ website authentication without any storage requirements.
7+
8+ Signed cookies allow you to implement sessions without any
9+ server storage requirments.
10+
11+ The connect framework let's zap together web applications
12+ with redonkulous efficiency.
13+
14+ ** connect-browserid** puts the first two together in a way
15+ that's crazy easy to use in the third. It's magic.
16+
17+ ## How you use it
18+
19+ ### install connect-browserid
20+
21+ npm install connect-browserid
22+
23+ ### put the middleware in your server
24+
25+ app.use(require('connect-browserid')({
26+ secret: "yabba dabba do"
27+ });
28+
29+ ### throughout your code, req.user is the authenticated user
30+
31+ if (req.user) res.send('hi ' + req.user);
32+ else res.send('I don't know you.');
33+
34+ ### post an assertion to ` /auth ` to authenticate
35+
36+ navigator.id.getVerifiedEmail(function(assertion) {
37+ if (assertion) {
38+ $.post("/auth", assertion, function(res) {
39+ if (res.success) alert("now you're logged in as: " + res.user);
40+ else alert("log in failure: " + res.reason);
41+ });
42+ }
43+ });
44+
You can’t perform that action at this time.
0 commit comments