Open emathias opened 7 years ago
Hi @emathias
There has another way to implement this.
You can add middleware to handle auth check, it support async function, and put the result into req
, then auth hook
just check this field.
Here is a example: middleware, auth hook.
But it can not solve some complex scene problems, such as data permissions check, I will try to let it become to a async function later.
Thank you.
Hi,
As of now, the implementation of node-odata requires 'auth' to be synchronous, as it has to return true or false. (as described here: http://tossshinhwa.github.io/node-odata/en/#51-resource)
In realistic scenarios, checking auth may usually entail some async operation (checking DB, etc) and because of the async nature of node, a control flow as express middleware (using next() ) seems more appropriate.
What do you think ?
Best,