This Gist is meant to show how testing authentication plugins with an expanded form of configuration versus the inline compact form results in an unexpected failure whilst testing. This case could occur if one wishes to enforce unique authentication options (like a required DB authentication versus a JWT session).
Expanded Form:
server.route({
method: 'POST',
path: '/sample-auth',
handler: function (request, reply) {
return reply(200);
},
config: {
auth: {
strategies: ['hardcoded']
}
}
});
Compressed:
server.route({
method: 'POST',
path: '/sample-auth',
handler: function (request, reply) {
return reply(200);
},
config: {
auth: 'hardcoded'
}
});