Skip to content

Commit

Permalink
Add google login method to example application.
Browse files Browse the repository at this point in the history
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
Jim Lloyd committed Nov 25, 2011
1 parent dc870d9 commit c608f2f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions example/conf.js
Expand Up @@ -19,4 +19,8 @@ module.exports = {
clientId: 'VUGE4VHJMKWALKDKIOH1HLD1OQNHTC0PBZZBUQSHJ3WKW04K' clientId: 'VUGE4VHJMKWALKDKIOH1HLD1OQNHTC0PBZZBUQSHJ3WKW04K'
, clientSecret: '0LVAGARGUN05DEDDRVWNIMH4RFIHEFV0CERU3OITAZW1CXGX' , clientSecret: '0LVAGARGUN05DEDDRVWNIMH4RFIHEFV0CERU3OITAZW1CXGX'
} }
, google: {
clientId: '224794776836-cp3a2v0elt955h9uqhgmskplhg85ljjm.apps.googleusercontent.com'
, clientSecret: 'rxGFo1mBG_H3DX2ifDFawiMZ'
}
}; };
9 changes: 9 additions & 0 deletions example/server.js
Expand Up @@ -76,6 +76,15 @@ UserSchema.plugin(mongooseAuth, {
, redirectPath: '/' , 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 // Adds login: String


Expand Down
17 changes: 11 additions & 6 deletions example/views/home.jade
Expand Up @@ -4,16 +4,18 @@
a(href='/register') Register a(href='/register') Register
#password-login #password-login
a(href='/login', style='border: 0px') Login with Password a(href='/login', style='border: 0px') Login with Password
#fb-login.fb_button(style='float: left; background-position:left -188px') #fb-login(style='float: left; margin-left: 5px')
a.fb_button_medium(href='/auth/facebook') a(href='/auth/facebook', style='border: 0px')
span#fb_login_text.fb_button_text img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/facebook_64.png')
Connect with Facebook #twitter-login(style='float: left; margin-left: 5px')
#twitter-login.fb_button(style='float: left; margin-left: 5px')
a(href='/auth/twitter', style='border: 0px') 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') #github-login(style='float: left; margin-left: 5px')
a(href='/auth/github', style='border: 0px') a(href='/auth/github', style='border: 0px')
img(style='border: 0px', src='http://github.com/intridea/authbuttons/raw/master/png/github_64.png') 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') #instagram-login(style='float: left; margin-left: 5px')
a(href='/auth/instagram', style='border: 0px') a(href='/auth/instagram', style='border: 0px')
img(style='border: 0px', src='https://instagram.com/static/images/headerWithTitle.png') img(style='border: 0px', src='https://instagram.com/static/images/headerWithTitle.png')
Expand All @@ -29,6 +31,9 @@
- if (everyauth.github) - if (everyauth.github)
h3 GitHub User Data h3 GitHub User Data
p= JSON.stringify(everyauth.github.user) p= JSON.stringify(everyauth.github.user)
- if (everyauth.google)
h3 Google User Data
p= JSON.stringify(everyauth.google.user)
- if (everyauth.instagram) - if (everyauth.instagram)
h3 Instagram User Data h3 Instagram User Data
p= JSON.stringify(everyauth.instagram.user) p= JSON.stringify(everyauth.instagram.user)
Expand Down

0 comments on commit c608f2f

Please sign in to comment.