Hapi auth plugin for the Screwdriver API
const Hapi = require('@hapi/hapi');
const server = new Hapi.Server();
const authPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: authPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});
This will generate a cookie with the JWT in it.
- OAuth:
GET /auth/login/{scmContext}
orPOST /auth/login/{scmContext}
- Token:
GET /auth/login/key?token=YOUR_API_TOKEN
- Guest:
GET /auth/login/guest
GET /auth/token
(with OAuth) or GET /auth/token?api_token=YOUR_API_TOKEN
(with API token)
GET /auth/key
POST /auth/logout
GET /auth/contexts