Hey team, looking for guidance around authorizing a request based on the thread id.
Looking to do something like this:
middleware: {
onBeforeRequest: ({ request, threadId }) => {
const token = getTokenFromRequest(request);
const user = getUserIdFromToken(token);
if (!canAccessThread(user, threadId)) {
throw new AuthorizationError('')
}
}
},
However it doesn't seem the request itself is passed to this middleware. Is there another recommendation you can give for how to handle this sort of authorization?