Permalink
Browse files

added google oauth

  • Loading branch information...
1 parent 89b6fc9 commit d6c9a5453dfa4e93eec81075e208b0bd3d199424 @bogdanmocan committed Nov 10, 2011
Showing with 36 additions and 3 deletions.
  1. +32 −2 app.js
  2. +4 −1 views/index.jade
View
34 app.js
@@ -9,13 +9,43 @@ var express = require('express')
, util = require('util')
, Promise = everyauth.Promise;
+var usersByFB = {};
+
everyauth.facebook
- .myHostname('http://......')
+ .myHostname('your domain')
.appId('your fb app id')
- .appSecret('your fb secret')
+ .appSecret('your fb secret token')
.findOrCreateUser( function (session, accessToken, accessTokExtra, fbUserMetadata) {
var user = { name: "nume"};
+
+ var promise = new Promise();
+ promise.fulfill(user);
+
+ return promise;
+ })
+ .redirectPath('/');
+
+everyauth.google
+ .appId('your google id')
+ .appSecret('your google secret')
+ .scope('https://www.google.com/m8/feeds') // What you want access to
+ .handleAuthCallbackError( function (req, res) {
+ // If a user denies your app, Google will redirect the user to
+ // /auth/facebook/callback?error=access_denied
+ // This configurable route handler defines how you want to respond to
+ // that.
+ // If you do not configure this, everyauth renders a default fallback
+ // view notifying the user that their authentication failed and why.
+ })
+ .findOrCreateUser( function (session, accessToken, accessTokenExtra, googleUserMetadata) {
+ // find or create user logic goes here
+ // Return a user or Promise that promises a user
+ // Promises are created via
+ console.log(googleUserMetadata);
+ var user = { name: "nume"};
+
+
var promise = new Promise();
promise.fulfill(user);
View
@@ -1,3 +1,6 @@
h1= title
p Welcome to #{title}
-a(href="/auth/facebook/") Login with Facebook
+div#fbLogin
+ a(href="/auth/facebook/") Login with Facebook
+div#gLogin
+ a(href="/auth/google/") Login with Google

0 comments on commit d6c9a54

Please sign in to comment.