question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Catch server errors like Client can not be authenticated, got HTTP status 401

See original GitHub issue

Hi,

I am using laravel-echo-server with laravel-echo, I would like to know if it is possible to catch server events like :

Client can not be authenticated, got HTTP status 401

I need to reconnect the user in case of his token has expired. Thanks for reply

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ndinhbangcommented, Apr 8, 2020

i had the same issue. i looked into the code and found that when fail to authenticate or authorized, laravel echo server emit subscription_error event

https://github.com/tlaverdure/laravel-echo-server/blob/b6838d8dc6fa053fa45dbdb5bb6d973bdbf15a23/src/channels/channel.ts#L107

then i listen on event to catch that error

Echo.connector.socket.on( 'subscription_error', (channel, data) => {
    console.log(channel, data); 
} );

P/s: sorry for my bad english

0reactions
driesvintscommented, Jul 31, 2020

Seems like this is a laravel-echo-server specific request which can best be documented on the docs for laravel-echo-server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Client can not be authenticated, got HTTP status 401 - Laracasts
Client can not be authenticated, got HTTP status 401. Hello,. I keep getting this error when i'm trying to use private channels (with...
Read more >
401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error is triggered by unauthenticated requests made to a WordPress web server. Learn how to identify and fix the issue....
Read more >
How to Quickly Fix the 401 Unauthorized Error (5 Methods)
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the ...
Read more >
Laravel Echo Client cannot be authenticated - Stack Overflow
When I fire my event, then I get the event in the console, but the user cannot be authenticated for some reason and...
Read more >
401 Unauthorized - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found