Hapi plugin providing a Google Identity Toolkit scheme
With a custom Gitkit client
var path = require('path');
var GitkitClient = require('gitkitclient');
var client = new GitkitClient({
clientId: 'YOUR_CLIENT_ID',
serviceAccountEmail: 'YOUR_SERVICE_ACCOUNT_EMAIL',
serviceAccountPrivateKeyFile: path.join(__dirname, 'privateKey.pem'),
widgetUrl: 'http://localhost:8000/gitkit'
});
server.register(require('hapi-auth-gitkit'), function(err){
server.auth.strategy('gitkit', 'gitkit', {
// Cookie name of auth token
cookie: 'gtoken',
client: client
});
server.route({
method: 'GET',
path: '/',
config: {
auth: 'gitkit'
}
});
});
Without a custom Gitkit client
server.register(require('hapi-auth-gitkit'), function(err){
server.auth.strategy('gitkit', 'gitkit', {
// Cookie name of auth token
cookie: 'gtoken'
// Gitkit Client Config
clientId: 'YOUR_CLIENT_ID',
serviceAccountEmail: 'YOUR_SERVICE_ACCOUNT_EMAIL',
serviceAccountPrivateKeyFile: path.join(__dirname, 'privateKey.pem'),
widgetUrl: 'http://localhost:8000/gitkit',
});
server.route({
method: 'GET',
path: '/',
config: {
auth: 'gitkit'
}
});
});
The 'gitkit'
scheme takes the following options:
The name of the cookie where the user token will be stored. This is retrieved and verified during authentication.
A custom Gitkit client instance can be passed. This option is useful for using a single Gitkit instance throughout the server.
The client id for your Gitkit application. Not used if the client
option is used.
The service account email for your Gitkit application. Not used if the client
option is used.
The location of your private key for your Gitkit application. Not used if the client
option is used.
The location of your login widget for your Gitkit application. Not used if the client
option is used.
MIT