Hello,
In the example oauth.authorize is passed with two different signatures, the first one is (request, reply, function ... ) and the second one is (function ...), was that an error? Because when token() is called, the following error is raised:
TypeError: Uncaught error: Cannot read property 'lazy' of undefined
at Object.internals.convertToExpress (/path/to/node_modules/hapi-oauth2orize/index.js:202:20)
function authorize(request, reply) {
oauth.authorize(request, reply, function (req, res) {
reply.view('oauth', {transactionID: req.oauth2.transactionID});
}, function (clientID, redirect, done) {
server.helpers.find('client', clientID, function (docs) {
done(null, docs[0], docs[0].redirect_uri);
});
});
};
function decision(request, reply) {
oauth.decision(request, reply);
};
function token(request, reply) {
oauth.authorize(function (clientID, redirect, done) {
done(null, clientID, redirect);
});
};
Also I wonder if it's possible to include authentication in the example. Should I use hapi-auth-cookie to handle authentication with oauth2orize?