Just looking for clarity here I think. Working through a React/Phoenix tutorial, but he is using old-style Guardian
and much seems to have changed for v1.0. I think I have everything set up correctly, but I am getting an invalid-token
error:
MyApp.Guardian.AuthErrorHandler.auth_error(
%Plug.Conn{…},
{:invalid_token, %CaseClauseError{term: {:error, {:badarg, ["null"]}}}},
[realm_reg: ~r/Bearer:? +(.*)$/i, realm: "Bearer"]
)
and I suspect that it is caused by the {"authorization", "Bearer: null"}
entry in the request header:
...
req_headers: [
{"host", "localhost:4000"},
{"connection", "keep-alive"},
{"content-length", "11"},
{"accept", "application/json"},
{"origin", "http://localhost:3000"},
{"user-agent", "blah blah"},
{"authorization", "Bearer: null"},
{"content-type", "application/json"},
{"referer", "http://localhost:3000/signup"},
{"accept-encoding", "gzip, deflate, br"},
{"accept-language", "en-US,en;q=0.8,it-IT;q=0.6,it;q=0.4,fr-FR;q=0.2,fr;q=0.2"}
],
request_path: "/api/users"
...
So I think this is a React problem, but I just want to confirm that before I start chasing it around the wrong room. I’m still new enough at both things that it’s all very much slow learning at this point.
For the curious, this is the tutorial.