Тёмный

WebSocket Authentication and Authorization 

Covalence
Подписаться 8 тыс.
Просмотров 15 тыс.
50% 1

In this video, we go through what we believe to be the best implementation of WebSocket authentication and authorization supporting both cookie and token strategies. The Node.js demo uses the node package ws in an Express app with TypeScript. Enjoy!
GitHub Repo: github.com/covalence-io/ws-auth
WS Template Video (Heartbeats): • Keep Those WebSocket C...
WS Template Repo: github.com/covalence-io/ws-te...
Cookies and Token Auth Video: • App Authorization Usin...
Don't forget to like this video and subscribe to our channel - we're publishing more videos and walkthroughs every week. Comment below and let us know what you'd like to see next!
Check us out at covalence.io
Join the Covalence community: covalence.io/membership
Shop Covalence merch: covalence.merchntly.com

Опубликовано:

 

6 апр 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 14   
@dashaxedit
@dashaxedit Год назад
Very cool. Thank you very much
@weeta34
@weeta34 4 месяца назад
Hello, thank you. fyi, starting @types/ws 8.5.5, isAlive property is not recognized.
@andresmartinez-losa5779
@andresmartinez-losa5779 3 месяца назад
Grear tutorial! How would you authenticate with digest? Thx
@laveshsaluja9478
@laveshsaluja9478 7 месяцев назад
while send headers to ws the req.headers.authorization is undefined even after sending the authToken?
@covalence-io
@covalence-io 7 месяцев назад
you can't use req.headers for websocket auth... that's kind of the whole point of the video. if you watch we put the token in the websocket url itself if using an access token ;)
@ashokchandra4911
@ashokchandra4911 Год назад
How to authenticate with traccar web socket api and get real time data please help
@covalence-io
@covalence-io Год назад
Never used traccar but happy to look into it! Their documentation is a good starting point though ;) www.traccar.org/documentation/
@Samsul2013
@Samsul2013 Год назад
can you do the same websocket auth using vanilla javascript instead of typescript?
@covalence-io
@covalence-io Год назад
The code is very similar... almost identical. You can change import statements to require statements and remove all types and you should be good to go!
@asldkfjalsdkjflaskjdfl
@asldkfjalsdkjflaskjdfl 11 месяцев назад
Hi, cool video, but I got a couple of questions: what should I do if token refreshes during the socket connection how token should be updated for opened connection properly? should I close the connection and open it again? should I develop protocol, that sends an event with new token to the server? and also I'm quite interested in how synchronizatino process should be done, if I got connection loss for some period of time I'd appreciate if someone answer at least on a couple of questions
@covalence-io
@covalence-io 11 месяцев назад
typically the authorization is done when the connection is opened... and then once it's opened you don't need to worry about it refreshing... the connection will simply remain opened until it's not. If it's closed you can handle authorization again but attempting to reopen the connection and if auth fails you may need to refresh the token. Performing synchronization well can be tough and usually involves reopening the connection while also making an api call to request past data as well and then manually adding missed data if applicable
@asldkfjalsdkjflaskjdfl
@asldkfjalsdkjflaskjdfl 11 месяцев назад
@covalence-io thank you a lot, I tried what you suggested and it works much better, then it was in my initial implementation with sending authorization token on every token refresh
@sabinbaral4132
@sabinbaral4132 Год назад
👏
Далее
Routing Your WebSockets!
26:16
Просмотров 2,1 тыс.
JWT Authentication Tutorial - Node.js
27:36
Просмотров 1 млн
How to scale WebSockets to millions of connections
14:01
WebSockets in 100 Seconds & Beyond with Socket.io
8:31
Mastering WebSockets With Go - An in-depth tutorial
2:24:34
I Stopped Using Express.js: Because Bun and Hono 🔥
10:23
Scaling and Securing WebSockets with HAProxy
19:42
Просмотров 21 тыс.