seneca-google-auth
v1.0.0
Published
google auth plugin for seneca-auth
Downloads
16
Readme
A Seneca.js Auth Plugin
seneca-google-auth
This plugin is used by seneca-auth for authenticating via google login. It uses PassportJS. The seneca-auth is the authentication plugin used by Seneca toolkit.
For a gentle introduction to Seneca itself, see the senecajs.org site.
If you're using this plugin module, feel to contact on twitter if you have any questions! :) @rjrodger
Install
npm install seneca-google-auth
Using Google Auth
When using seneca-auth
the google auth must be initialized using:
..........
service: {
"local": {},
"google" : {
"clientID" : "your client id",
"clientSecret" : "app secret",
"urlhost" : "server host",
"serviceParams": {
"scope" : [
.....
]
}
}
}
..........
Note: serviceParams
can be used to pass any other parameter to the passport google strategy.
More information can be found in the Google documentation.
Other information
There is provided a default seneca action that will prepare user data to a more convenient structure. If this data structure is not matching the expected user data structure used by your application, you can overwrite the seneca action and implement your own google-login-data action.
{role: 'auth', prepare: 'google_login_data'}
The JSON object provided for this actions contains following data from Google login:
accessToken
refreshToken
profile
Note: You can provide also the callbackUrl
as part of the options. If not provided then a default value is used.
Default value for callbackUrl
: /auth/google/callback