-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Request: Do not require 'token' to be set by Provider for OnAuthenticate in Client #596
Comments
thx for the report! We noticed the same for our cloud (where we allow anonymous access if wanted), and are also using |
Hi @janthurau, I don't have an The first loading is ok, but when it reconnects after some timeout, the connection closes and won't open. I've tried to work around it in many ways described in the documentation but to no avail. I'm using the latest version of HocuspocusProvider and HocuspocusServer - 2.0.6 Can you suggest something? Thanks! |
I am passing a token (intentionally) and I'm still getting this message :D |
Same here |
I cannot reproduce this (@valstu @juliankrispel @DenysPoliarush), if you can provide me with a sandbox / replit I'll have a look right away. Please move to #566 though, this issue here is about something else. |
I'm not 100% sure yet but this could be related to thing that React in strict mode will call all the effects twice on initial render (mount, unmount and mount again). I destroyed the connection when unmounting (using useEffect return) as it is supposed to but it seems that there are two websocket connections after that which somehow breaks things. I guess the hocuspocus instance was destroyed but not the websocket, anyways it was a late night while debugging this so some of the facts has disappeared from my brain 😅 But I'll try to see if I can reproduce some sandbox in the coming days. |
@juliankrispel @valstu hi. Have you managed to investigate on this? I am also passing token, but i am receiving these messages. It doesn't looks to me that there are any multiple connections and I am pretty sure that every time I initiate connection i pass the token. |
The problem I am facing
I have a cookie stored in the request headers, which is consumed by my auth. However, in order to make use of the OnAuthenticate hook (And to not get messages like
[HocuspocusProvider] An authentication token is required, but you didn’t send one. Try adding a `token` to your HocuspocusProvider configuration. Won’t try again.
) , I need to set token to be non nil. A placeholder token like "please_use_auth" works, but I do not see why it is necessary.The solution I would like
Allow token to be optional, either by default or through configuration
Alternatives I have considered
Using a placeholder token such as "please_use_auth"
The text was updated successfully, but these errors were encountered: