diet-auth
Dead-simple authentication for diet.js.
Install
npm install diet-auth
Supported Services
Service | Protocol | Scope List |
---|---|---|
OAuth 2.0 | https://developers.facebook.com/docs/facebook-login/permissions/v2.1 | |
OAuth 2.0 | https://developers.google.com/+/api/oauth |
More services are coming soon.
Example Facebook Authentication
// index.jsvar server = var app = appvar auth = app // Setup Auth Servicevar facebook = // Listen on GET /auth/facebook/redirectapp
- Visiting
http://localhost:8000/auth/facebook
will bring up the facebook login page. - After the user agreed or declined access to the application it will be redirected to your Redirect URL that is held in
facebook.redirect
- if
$.passed
istrue
then you'll have access to the$.data.user
object that contains every profile information that you requested with the scope. - If
$.passed
isfalse
then you can see what's wrong in the$.error
method.
API
diet-auth
has a generalised api for all services. The only differences between services is the scope names and the $.data.user
object.
// Setup Auth Service var yourService = auth // Listen on GET /auth/yourService/redirectapp
Upcoming Features:
-
Better API documentation
-
Twitter authorization
-
Linkedin authorization
-
Github authorization
-
Windows Live authorization
-
Yahoo authorization
-
Trello authorization