Strange `CaseClauseError`

@benwilson512 thanks I have the following code now for my SessionView:

defmodule LibraryApiWeb.SessionView do
  use LibraryApiWeb, :view

  def render("token.json", %{user: user}) do
    data = %{id: user.id, email: user.email, username: user.username}
    jwt = %{data: data, sub: user.id}
    theToken = Joken.generate_and_sign!(jwt, nil, Joken.Signer.create("HS512", "SOMESECRETVALUE"))
    %{token: theToken}
  end
end

The current problem that I am facing is that the generated token is invalid.
What could I be doing wrong with Joken this time?