Skip to content

How can I check if a user is logged in or not in socket.io with AdonisJS session csrf #4646

Closed Answered by MrAhmedElkady
MrAhmedElkady asked this question in Help
Discussion options

You must be logged in to vote

AdonisJS V6 after a lot of research, the solution is as follows: You can use this repository which includes the connection but through the API with an access token. This will solve the auth issue, but I hope the developers of AdonisJS will support this matter themselves and create solutions for this problem and improve their documentation.

Link GitHub: Adonis chat demo

Connection method:

const socket = io("http://localhost:3333/", {
    extraHeaders: {
      authorization:  "Bearer <token>",
    },
  });

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MrAhmedElkady
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants