Is it possible to attach jwt bearer token to header on phoenix channel websocket connection?

Is it possible to attach a jwt bearer token to the header of the websocket connection?

I’m using an Amazon Application Load Balancer which has native support for checking Cognito (AWS’s authentication and jwt vending service) before it forwards the request to the server.

I was wondering if I can have the Load Balancer block unauthenticated connections before it even reaches the Elixir server.

The alternate route would be to directly pass the jwt token to the Elixir server itself and check against the Cognito service.

I think i’d rather have the request be kicked out at the Application Load Balancer level before it reaches the server.

How would I go about attaching an ‘Authorization: Bearer’ header to the Phoenix.js websocket connection?


It looks like no, because WebSocket doesn’t make this possible. Source at

1 Like

Got it, thanks again!