Skip to content
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

feat: socketio bearer authentication #1999

Merged
merged 6 commits into from
Dec 30, 2021

Conversation

rakshit087
Copy link
Contributor

Working on #1953

@netlify
Copy link

netlify bot commented Dec 7, 2021

👷 Deploy request for hoppscotch pending review.
Visit the deploys page to approve it

🔨 Explore the source changes: 1e4fac8

@rakshit087
Copy link
Contributor Author

Worked on the frontend part.

image

I am kind of confused how to send data to '@hoppscotch/data', since REST authentication uses it to load data. Any help is appreciated.

@rakshit087 rakshit087 changed the title feat: socketio auth initial feat: socketio bearer authentication Dec 8, 2021
@Nijinsha
Copy link

@rakshit087 I think you should be using the token on socketio.vue file.

@rakshit087
Copy link
Contributor Author

rakshit087 commented Dec 24, 2021

Yes I will, caught up in my Final Exams for now. I am working on it right now

@rakshit087
Copy link
Contributor Author

I have completed most of the work,

Without the token
image

With Token
image

With wrong token
image

The changes were made according the documentation by SocketIO
https://socket.io/docs/v4/middlewares/

The server code is here

io.use((socket, next) => {
  const token = socket.handshake.auth.token;
  console.log(token);
  if(checkJWT(token)) next();
  else next(new Error("not authorized"));
})

@rakshit087 rakshit087 marked this pull request as ready for review December 30, 2021 08:38
@liyasthomas liyasthomas self-assigned this Dec 30, 2021
@liyasthomas liyasthomas self-requested a review December 30, 2021 08:39
liyasthomas
liyasthomas previously approved these changes Dec 30, 2021
@liyasthomas liyasthomas merged commit 93fa3bc into hoppscotch:main Dec 30, 2021
@rakshit087
Copy link
Contributor Author

Thank you for merge!

@rakshit087 rakshit087 deleted the socketioauth branch December 30, 2021 11:27
@liyasthomas liyasthomas linked an issue Jan 1, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket.io auth
3 participants