-
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
Doesn't work with Laravel Sanctum #26
Comments
➤ Automation for Jira commented: The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3944 |
@zoranlorkovic thanks for raising the issue. We will look into adding support for the same. |
@sacOO7 do you have any planned date for the release? We are blocked with this error, any alternative solution? TIA |
@KalanaPerera let me check if there is a way to use this feature without making explicit changes to the code |
@zoranlorkovic @KalanaPerera It seems we already have a solution here, you need to pass
Basically this code is equivalent of laravel-echo/src/channel/ably/auth.ts Lines 34 to 49 in 85f4dbc
I think we don't need to provide extra headers in case of axios. I will update README for the same. |
@zoranlorkovic @KalanaPerera |
@sacOO7 I think we're getting somewhere. My Laravel endpoint is not returning "CSRF token mismatch" error anymore and it's returning "token" value which is correct. However, it seems Echo is not subscribing to channel when using Echo.private('channelName'). Do we need to specify these values when creating Echo instance? The other thing I've noticed is warning message in my browser console window: |
@zoranlorkovic wait a minute, let me check on this 🙂 |
@zoranlorkovic can you check or log the response for laravel-echo/src/channel/ably/token-request.ts Lines 12 to 16 in 85f4dbc
Seems you need to modify code as
Also, do not add try/catch inside the code, it's already handled internally. |
@sacOO7 Response from
Another thing I've noticed is that when using pusher "channel_name" and "socket_id" are sent to "/broadcasting/auth". |
We have customized endpoint Lines 157 to 165 in 85f4dbc
We will know it when at the top level everything works fine. |
@zoranlorkovic let me know if code is working as per changes mentioned in the comment -> #26 (comment) |
Also, don't forget to star both repos https://github.com/ably/laravel-broadcaster and https://github.com/ably-forks/laravel-echo/. |
Ah, you're right, sorry about that. I was looking at default Laravel And it seems it does sends correct channel name when subscribing as I've noticed that in first call it makes to
but on every other request which is making every 45s or so it's just sending this data:
|
Okay, let me check that one too 👍 |
Hi @zoranlorkovic |
For every new |
The last thing I want to check before doing further testing, what could be this warning message in console window:
|
Okay, is this still happening after making this change
Note that, we have modified the code to return |
This seems to resolve this issue. Now there are just two requests to First one is with data:
result:
Second request:
result:
Is this excepted result? Also that message: |
@zoranlorkovic ofc, it should work! This is expected result : ) |
Ah, so sorry, don't know how I missed that additional code you've mentioned in #26 (comment) ! Repos already starred! |
Thanks! Please feel free to raise more issues 👍. |
Thank you for your help and quick replies @sacOO7 ! I've almost call it a day and returned back to Pusher but your quick replies really pushed me to stay and try again. Even after you've sent the solution an hour ago :) |
Haha, no worries! |
Echo Version
1.0.3
Laravel Version
10.10
PHP Version
8.2
NPM Version
10.2
Database Driver & Version
No response
Description
Hi,
To be able to work with Laravel Sanctum, we should be able to to set a custom authoriser (axis) which is predefine for a cross-domain requests, similar as we need for Pusher (please check: https://laravel.com/docs/10.x/sanctum#authorizing-private-broadcast-channels)
But this is not possible if using Laravel Echo from Ably as there isn't an option to do so and you're getting "CSRF token mismatch." error when you try to auth to private channel.
I've tried to set csrfToken and bearerToken but it didn't worked.
Steps To Reproduce
The text was updated successfully, but these errors were encountered: