-
Notifications
You must be signed in to change notification settings - Fork 18
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
Allow upgrade hook to return custom response #16
Comments
Maybe by allows to |
Yes. It's possible, but we can't change the Response like that. |
We might expose a new export default defineWebSocketHandler({
async upgrade(req) {
const authenticated = await authenticate(req);
if (!authenticated) {
return {
error: { status: 401, statusMessage: 'Unauthorized' }
};
}
return {
headers
}
}
}) The thrown |
upgrade
(auth)
@pi0 good sound |
Authentication is not complete without accessing the session information for a peer. Is there a way to, for example, bind the authenticated Or is it supposed to be handled manually via |
Is there any progress on this one? I also want to authenticate on upgrade, because doing it later on is somewhat tricky. |
upgrade
(auth)
Added in #55. It will be possible in next release to use |
Describe the feature
Here you also need to add an authentication check during the upgrade handshake, for example, only authorized users can enter the socket in order to then save the client user information
Examle event:
This is just an example since in this code there is no way to refuse clients who have passed
Additional information
The text was updated successfully, but these errors were encountered: