1.3.10 • Published 9 years ago

cthulhu-auth v1.3.10

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

Cthulhu Auth

This module provides social authentication strategies in the vain of passport and everyauth but comes coupled many strategies.

Available Strategies

  • Facebook
  • Google
  • Twitter
  • Foursquare
  • GitHub

Usage

var app = require('cthulhu')({
  //...
});
var cthulhuAuth = require('cthulhu-auth');

app.use(cthulhuAuth.setup)

app.use(cthulhuAuth.deserializeUser(function(user, done) {
  // Find user and pass done error and user
  // Example for Mongoose:
  // User.findOne(user.id).exec(done)
}));

Facebook

  //...
  var facebookAuth = require('cthulhu-auth').Facebook({
    app_id: 'APPID',
    app_secret: 'APPSECRET',
    callback_url: 'http://www.whatevz.com/auth/facebook/callback'
  });


  app.get('/auth/facebook', facebookAuth.authorize);
  app.get('/auth/facebook/callback', facebookAuth.callback, someCallback);

The .callback() function attaches an oauth value to req:

  req.oauth = {
    provier: 'facebook',
    token: 'access token from Facebook',
    profile: {
      // Profile of user from oauth provider
    }
  }

GitHub

//...
var githubAuth = require('cthulhu-auth').Github({
  client_id: 'CLIENTID',
  client_secret: 'CLIENTSECRET',
  callback_url: 'http://www.whatevz.com/auth/github/callback'
});


app.get('/auth/github', githubAuth.authorize);
app.get('/auth/github/callback', githubAuth.callback, someCallback);

The .callback() function attaches an oauth value to req:

req.oauth = {
  provier: 'github',
  token: 'access token from GitHub',
  profile: {
    // Profile of user from oauth provider
  }
}

Google

//...
var googleAuth = require('cthulhu-auth').Google({
  client_id: 'CLIENTID',
  client_secret: 'CLIENTSECRET',
  redirect_uri: 'http://www.whatevz.com/auth/google/callback'
});


app.get('/auth/google', googleAuth.authorize);
app.get('/auth/google/callback', googleAuth.callback, someCallback);

The .callback() function attaches an oauth value to req:

req.oauth = {
  provier: 'google',
  token: 'access token from Google',
  profile: {
    // Profile of user from oauth provider
  }
}

Twitter

//...
var twitterAuth = require('cthulhu-auth').Twitter({
  consumer_key: 'CONSUMERKEY',
  consumer_secret: 'CONSUMERSECRET',
  callback_url: 'http://www.whatevz.com/auth/twitter/callback'
});


app.get('/auth/twitter', twitterAuth.authorize);
app.get('/auth/twitter/callback', twitterAuth.callback, someCallback);

The .callback() function attaches an oauth value to req:

req.oauth = {
  provier: 'twitter',
  token: 'access token from twiter',
  secret: 'secret from Twitter'
  profile: {
    // Profile of user from oauth provider
  }
}

Foursquare

//...
var foursquareAuth = require('cthulhu-auth').Foursquare({
  client_id: 'CLIENTID',
  client_secret: 'CLIENTSECRET',
  callback_url: 'http://www.whatevz.com/auth/foursquare/callback'
});


app.get('/auth/foursquare', foursquareAuth.authorize);
app.get('/auth/foursquare/callback', foursquareAuth.callback, someCallback);

The .callback() function attaches an oauth value to req:

req.oauth = {
  provier: 'foursquare',
  token: 'access token from Foursquare',
  profile: {
    // Profile of user from oauth provider
  }
}
1.3.10

9 years ago

1.3.9

9 years ago

1.3.8

9 years ago

1.3.7

9 years ago

1.3.6

9 years ago

1.3.5

9 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago