Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Did you not find ciaranj's <a href="https://github.com/ciaranj/connect-auth" rel="nofollow noreferrer">connect-auth</a></p> <pre><code>const fbId = ""; #x const fbSecret = ""; #y const fbCallbackAddress= "http://localhost:4000/auth/facebook"; //var RedisStore = require('connect-redis'); var express= require('express'); var auth= require('connect-auth') var app = express.createServer(); app.configure(function(){ app.use(express.cookieDecoder()); app.use(express.logger()); //app.use(connect.session({ store: new RedisStore({ maxAge: 10080000 }) })); app.use(express.session()); app.use(auth( [ auth.Facebook({appId : fbId, appSecret: fbSecret, scope: "email", callback: fbCallbackAddress}) ]) ); }); app.get('/logout', function(req, res, params) { req.logout(); res.writeHead(303, { 'Location': "/" }); res.end(''); }); app.get('/', function(req, res, params) { if( !req.isAuthenticated() ) { res.send('&lt;html&gt; \n\ &lt;head&gt; \n\ &lt;title&gt;connect Auth -- Not Authenticated&lt;/title&gt; \n\ &lt;script src="http://static.ak.fbcdn.net/connect/en_US/core.js"&gt;&lt;/script&gt; \n\ &lt;/head&gt;&lt;body&gt; \n\ &lt;div id="wrapper"&gt; \n\ &lt;h1&gt;Not authenticated&lt;/h1&gt; \n\ &lt;div class="fb_button" id="fb-login" style="float:left; background-position: left -188px"&gt; \n\ &lt;a href="/auth/facebook" class="fb_button_medium"&gt; \n\ &lt;span id="fb_login_text" class="fb_button_text"&gt; \n\ Connect with Facebook \n\ &lt;/span&gt; \n\ &lt;/a&gt; \n\ &lt;/div&gt;&lt;/body&gt;&lt;/html&gt;'); } else { res.send( JSON.stringify( req.getAuthDetails()) ); } }); // Method to handle a sign-in with a specified method type, and a url to go back to ... app.get('/auth/facebook', function(req,res) { req.authenticate(['facebook'], function(error, authenticated) { if(authenticated ) { res.send("&lt;html&gt;&lt;h1&gt;Hello Facebook user:" + JSON.stringify( req.getAuthDetails() ) + ".&lt;/h1&gt;&lt;/html&gt;") } else { res.send("&lt;html&gt;&lt;h1&gt;Facebook authentication failed :( &lt;/h1&gt;&lt;/html&gt;") } }); }); </code></pre> <p>app.listen(4000);</p> <p><img src="https://i.stack.imgur.com/X2oE1.png" alt="facebook settings"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload