Middleware to generate a token per request