GithubHelp home page GithubHelp logo

cthulhu-auth's Introduction

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
  }
}

cthulhu-auth's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.