How to implement flask restplus authorizations How to implement flask restplus authorizations flask flask

How to implement flask restplus authorizations


Very recently, I ran into a similar problem. But luckily we do have the Namespace that accepts a list of decorators, where in you can pass the custom decorator at Resource level, and it will be implemented by default to each method of that resource.

api = Namespace(    'some Name here',    description='some description',    security='apiKey',    authorizations = authorizations,    decorators= [token_required])

One point to note however, I had to just specify the security with each doc in the method, as under:

@api.doc('some operation', security = 'apiKey')

The beauty with this is that one click authorization flows to each method in the resource.