Skip to content

Commit

Permalink
auth_token does not need to be passed to connect_info
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Feb 19, 2025
1 parent db8eac8 commit e3103e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guides/real_time/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,14 @@ When we connect, we'll often need to authenticate the client. Fortunately, this

### Step 1 - Enable the `auth_token` functionality in the socket

Phoenix supports a transport agnostic way to pass an authentication token to the server. To enable this, we need to pass the `:auth_token` option to the socket declaration in our `Endpoint` module and configure the `connect_info` to include the `:auth_token` key.
Phoenix supports a transport agnostic way to pass an authentication token to the server. To enable this, we need to pass the `:auth_token` option to the socket declaration in our `Endpoint` module.

```elixir
defmodule HelloWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :hello

socket "/socket", HelloWeb.UserSocket,
websocket: [connect_info: [:auth_token]],
websocket: true,
longpoll: false,
auth_token: true

Expand Down

0 comments on commit e3103e8

Please sign in to comment.