Plug passport-google-oauth npm module in we.js project with auth urls
we i we-plugin-passport-google
Passport strategies for authenticating with Google using OAuth 1.0a and OAuth 2.0.
This plugin lets you authenticate using Google in your We.js applications.
The client id and client secret needed to authenticate with Google can be set up from the developer's console Google Developer's Console: https://console.developers.google.com/project .
To configure in your project update the file: config/locals.js
:
// ...
passport: {
strategies: {
google: {
clientID: 'your google api client id',
clientSecret: 'your google api client secret',
// scope: [
// 'profile',
// 'email',
// 'https://www.googleapis.com/auth/plus.me',
// 'https://www.googleapis.com/auth/userinfo.email'
// ],
// callbackURL: 'a custom callback url' // optional
}
}
},
// ...
This url will start the authentication.
'get /auth/google': {
controller : 'passportGoogle',
action : 'page',
responseType : 'json'
},
'get /auth/google/callback': {
controller : 'passportGoogle',
action : 'callback',
responseType : 'json'
}
- We.js site: http://wejs.org
- Google passport npm module: https://github.com/jaredhanson/passport-google-oauth
MIT