-
-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: need Request in static onAuth #693
Comments
Hi @hunkydoryrepair, thanks for the feedback. For the uWebSockets transport I had to pass a "mocked" version of the request due to the optimizations uWebSockets does internally pruning the instance. (request is not available on async calls) So far only the Can you share how are you currently retrieving the IP address from the uWebSockets' so we can include it as well? I think this is a good opportunity to start thinking on unifying all transports into a single API. For WebTransport I'm afraid we'll need a similar approach. The mocked structure would look like this so far: {
ip: "xxx.xxx.xxx.xxx",
headers: {
key: "value"
},
} (Might be a good idea to provide URLs, protocol, paths, etc as well 🤔 ) |
On the regular request.headers['x-forwarded-for'] || request.socket.remoteAddress |
Sorry, I guess I was referring to an earlier version that did not pass in the request at all (at least, was not documented). Yes, we use x-forwarded-for and the The issue we have remaining is we need the options passed to
We check bots, require a matching client version, require our own token registered with Stytch, we validate that the player hasn't changed since with authenticated using the save date, etc. We need it all. Switching to static onAuth not an option without the data. |
We do other checks, too, that require the room state, but those can probably be moved to |
can close this. would be nice to have the options in the onAsync, but not required. |
Thanks @hunkydoryrepair, let's keep this open for discussion, though - as I think for v1.0 we could provide a unified "request/context" object that is the same for every transport during |
Context & Description
with the switch to static onAuth, the biggest issue we face is not being able to access the Request object.
That is needed to get the player IP address.
Use cases
allowing switch to static onAuth for any game that uses the Request object.
Proposed API
pass Request object to the static onAuth as a new parameter.
The text was updated successfully, but these errors were encountered: