How to make the top level endpoint public when authorization is used in eve?

100 Views Asked by At

I am working on a REST API with python-eve. I use authorization with a subclass of the default TokenAuth class as described in the documentation. However now a GET Request to / replies with error code 401 and the message "Please provide proper credentials".

I want a GET request to / to just return the default list of available resources without authorization.

For a regular endpoint I would just add GET to the public_methods property in the schema, but / does not have a schema, how can I make it a public endpoint again?

1

There are 1 best solutions below

0
On BEST ANSWER

You could go the other way around. Set PUBLIC_METHODS to ['GET'] so home endpoint is accessible. Then you set public_methods to [] for every protected resource.