Permalink
Browse files

Add google login method to example application.

This shows how to configure Google OAuth using cronopio's implementation.
Uses intridea's authbuttons for google, and changes the existing
buttons for facebook and twitter to also use intridea's authbuttons,
giving a consistent look for all OAuth logins except for Instagram.
  • Loading branch information...
1 parent dc870d9 commit c608f2f85625b1d9fbf062d1f123d3815cbb8fd6 Jim Lloyd committed Nov 25, 2011
Showing with 24 additions and 6 deletions.
  1. +4 −0 example/conf.js
  2. +9 −0 example/server.js
  3. +11 −6 example/views/home.jade
View
4 example/conf.js
@@ -19,4 +19,8 @@ module.exports = {
clientId: 'VUGE4VHJMKWALKDKIOH1HLD1OQNHTC0PBZZBUQSHJ3WKW04K'
, clientSecret: '0LVAGARGUN05DEDDRVWNIMH4RFIHEFV0CERU3OITAZW1CXGX'
}
+ , google: {
+ clientId: '224794776836-cp3a2v0elt955h9uqhgmskplhg85ljjm.apps.googleusercontent.com'
+ , clientSecret: 'rxGFo1mBG_H3DX2ifDFawiMZ'
+ }
};
View
9 example/server.js
@@ -76,6 +76,15 @@ UserSchema.plugin(mongooseAuth, {
, redirectPath: '/'
}
}
+ , google: {
+ everyauth: {
+ myHostname: 'http://localhost:3000'
+ , appId: conf.google.clientId
+ , appSecret: conf.google.clientSecret
+ , redirectPath: '/'
+ , scope: 'https://www.google.com/m8/feeds'
+ }
+ }
});
// Adds login: String
View
17 example/views/home.jade
@@ -4,16 +4,18 @@
a(href='/register') Register
#password-login
a(href='/login', style='border: 0px') Login with Password
- #fb-login.fb_button(style='float: left; background-position:left -188px')
- a.fb_button_medium(href='/auth/facebook')
- span#fb_login_text.fb_button_text
- Connect with Facebook
- #twitter-login.fb_button(style='float: left; margin-left: 5px')
+ #fb-login(style='float: left; margin-left: 5px')
+ a(href='/auth/facebook', style='border: 0px')
+ img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/facebook_64.png')
+ #twitter-login(style='float: left; margin-left: 5px')
a(href='/auth/twitter', style='border: 0px')
- img(style='border: 0px', src='http://apiwiki.twitter.com/f/1242697715/Sign-in-with-Twitter-darker.png')
+ img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/twitter_64.png')
#github-login(style='float: left; margin-left: 5px')
a(href='/auth/github', style='border: 0px')
img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/github_64.png')
+ #google-login(style='float: left; margin-left: 5px')
+ a(href='/auth/google', style='border: 0px')
+ img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/google_64.png')
#instagram-login(style='float: left; margin-left: 5px')
a(href='/auth/instagram', style='border: 0px')
img(style='border: 0px', src='https://instagram.com/static/images/headerWithTitle.png')
@@ -29,6 +31,9 @@
- if (everyauth.github)
h3 GitHub User Data
p= JSON.stringify(everyauth.github.user)
+ - if (everyauth.google)
+ h3 Google User Data
+ p= JSON.stringify(everyauth.google.user)
- if (everyauth.instagram)
h3 Instagram User Data
p= JSON.stringify(everyauth.instagram.user)

0 comments on commit c608f2f

Please sign in to comment.