Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

feat: lookup auth header if token is not present in handshake #344

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dkadiog
Copy link

@dkadiog dkadiog commented Mar 23, 2023

What changes this PR introduce?

If a middleware sets the token for the request, its not present in the handshake and therefore not authorized. This supports also a auth header.

List any relevant issue numbers

Is there anything you'd like reviewers to focus on?

If a middleware sets the token for the request, its not present in the handshake and therefore not authorized. This supports also a auth header.
@@ -42,6 +42,9 @@ export const authorize = (options: AuthorizeOptions): SocketIOMiddleware => {
return async (socket, next) => {
let encodedToken: string | null = null
const { token } = socket.handshake.auth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { token } = socket.handshake.auth
let { token } = socket.handshake.auth

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants