krakenjs / swaggerize-express

Design-driven apis with swagger 2.0 and express.
Other
354 stars 81 forks source link

Authorization using Security Parameters not working #106

Closed mayank-india closed 8 years ago

mayank-india commented 8 years ago

Code is not reaching till authorization handler..

...
 "security": [
                    {
                        "autopass": [
                            "read_user"
                        ]
                    }
                ],

..

and security definitions:

..
"securityDefinitions": {
        "autopass": {
            "x-authorize": "security/autopass_authorize.js",
            "type": "oauth2",
            "scopes": {
               "read_user": "read your pets"
            },
            "flow": "implicit",
            "authorizationUrl": "security/autopass_authorize.js"

        }
    }

and the file security/autopass_authorize.js:

'use strict';

module.exports = function authorize(req, res, next) {
    console.log("IN authorize");
};

Please help!!!!!!!!!!!!!!!!

subeeshcbabu-zz commented 8 years ago

Can you link the complete Swagger(OpenAPI) document? Also it would be useful if you could link your github repo.

subeeshcbabu-zz commented 8 years ago

@mayank-india - Published swaggerize-routes@1.0.9 version that reads the security directories by default. This would not be related to the issue that you are facing because, you seem to be specifying the x-authorize handler. However its worth to use the swaggerize-routes@1.0.9 version try how that goes.

mayank-india commented 8 years ago

@subeeshcbabu Thanks. I will try 1.0.9. And yes re swaggerizing the source resolved issue.