t1msh / node-oauth20-provider

OAuth 2.0 provider toolkit for nodeJS, standalone server and express middleware support
MIT License
640 stars 145 forks source link

Error in documentation #22

Open hinderberg opened 9 years ago

hinderberg commented 9 years ago

The doc states that you can use a callback in server.get to render the decision page.

server.get('/authorization', isAuthorized, oauth2.controller.authorization, function(req, res) {
    // Render our decision page
    // Look into ./test/server for further information
    res.render('authorization', {layout: false});
});
server.post('/authorization', isAuthorized, oauth2.controller.authorization);

But the decision page always rendered is the one specified in oauth20.decision. The file lib/controller/authorization states req.ouath.decision(req, res, client, scope, user, redirectUri)

This is an error in the documentation right?

function(err) {
        if (err) response.error(req, res, err, redirectUri);
        else {
            if (req.method == 'GET')
                req.oauth2.decision(req, res, client, scope, user, redirectUri);
            else if (grantType == 'authorization_code')
                authorization.code(req, res, client, scope, user, redirectUri);
            else if (grantType == 'implicit')
                authorization.implicit(req, res, client, scope, user, redirectUri);
            else
                response.error(req, res, new error.invalidRequest('Wrong request method'), redirectUri);
        }
    });
t1msh commented 9 years ago

Y, it is documentation error that i forgot to fix. Ty for your attention and sry for my late reply.