Run Koa Middleware After authentication hook, but before all other hooks #3218
-
I have an upload service that uses multer in order to parse files into the request object and then upload them to a storage location of my choosing, it then stores a record of the storage details in the database adapter for that service. The problem is multer is run as a middleware so i'm using the koa.before to run it which works great, however since it runs before the authenticate hook any user can upload files to my storage bucket (they will get a 401 but not until after the file has been stored). Is there a way to run the koa middleware after the authentication hook but before the service call? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can use the authenticate Koa middleware |
Beta Was this translation helpful? Give feedback.
-
Thanks so much @daffl . That's my fault for glossing over that portion of the docs. |
Beta Was this translation helpful? Give feedback.
You can use the authenticate Koa middleware