-
Notifications
You must be signed in to change notification settings - Fork 4
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
401 Error on Subsequent Private/Public Channel Subscriptions #36
Comments
Hi @zorenkonte I am not sure if you have set up auth. for ably properly. I would recommend you to go through following docs carefully
|
Hi @sacOO7, Thank you for your reply. I apologize for the delayed response. I stopped working on this issue after a few attempts and moved on to another task. However, I recently revisited it and believe I have identified the cause of the 401 error. I am using jwt-auth for authentication, which by default checks the token payload in the request. Ably Laravel Broadcaster also returns and find a Commenting out the InputSource resolved the issue for me or by following the instruction from this reply. However, this solution could be improved. It would be beneficial to provide an option for a custom token key name in the payload to avoid conflicts with other authentication methods. |
Hi @zorenkonte thanks for the response! |
Thank you, @sacOO7 Closing this issue now. |
Echo Version
1.0.4
Laravel Version
8.83.27
PHP Version
8.3.6
NPM Version
10.5.2
Database Driver & Version
No response
Description
I'm encountering a 401 (unauthorized) error when attempting to subscribe to private channels using Laravel Echo and Ably integration. This issue arose after switching from Pusher to Ably because im having an issue about presence channel (where someone also experienced similar problems - https://stackoverflow.com/questions/57297057/laravel-echo-server-detect-user-disconnection). The first call to a public channel works successfully, but subsequent calls to private channels fail. Reordering the calls doesn't resolve the issue. I dont have problems with authentication before I switch to ably as broadcaster.
Expected Behavior:
All channel subscriptions (public and private) should be successful using the provided authentication mechanism.
Actual Behavior:
window.Echo.join(channels.online)
(public channel) subscribes successfully.window.Echo.private(...)
(private channels) result in a 401 error.Here is my full setup
Steps To Reproduce
Steps to Reproduce:
window.Echo.private('user.2')
).Expected Result:
All channel subscriptions should succeed.
Actual Result:
Only the first channel subscription succeeds. Subsequent channel subscriptions result in a 401 error.
Additional Information:
requestTokenFn
function to retrieve a fresh token, but the issue persists. (Doesn't work with Laravel Sanctum #26 )I would appreciate any guidance on how to resolve this issue and successfully subscribe to private channels using this package.
The text was updated successfully, but these errors were encountered: