Here is my use case what I am implementing -
I have "Users" table which is having the registered users of our application.
When a user does Sign In on our application I have to do the following things -
1. Get Username & Password from the request // (will be done in custom endpoint)
2. Check for the user exist with the given username & password in Users table // (will be done in custom endpoint)
a) If user exists then generate a session token lets say of 32 alphanumeric characters and save this token in the Users table itself with its timeout period. And also send this token in response to the user so that he can send this token in next request he is going to make. And from here the actual picture/use case starts
3. Now each request needs to be checked for the session token which we have sent in the response in step #2 above and for this I got to know that this can be achieved by Request Events.
4. And thats what I am implementing now, I am checking for the session token in each request in the Reqeust Event and if it exist then I need to find that token in the Users table to check it for its expiry. For which I need to query the Users Resource by any way restGet/getFunction/etc but it is the point where I am facing the error as I described in the main question.