Closed hiroya8649 closed 5 years ago
The error you are getting is because the token is signed with a map with atom keys, but the get_by
function clauses are using maps with string keys.
Yeah, I had modified the get_by
function to get it to work, but this code was originally generated by installer. So maybe there need some fix up?
If it's just fine then let's close this issue.
I will fix the installer in a day or two.
I have updated the installer with changes to the Token.sign
call. Can you try that and let me know if there are any existing issues?
@riverrun I have try with the newest 2.0.0 installer and it works fine, thanks for your quick fix!
Environment
Elixir & Erlang/OTP versions (elixir --version): Erlang/OTP 20 [erts-9.3.3.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] Elixir 1.7.0 (compiled with Erlang/OTP 19)
Operating system: macOS Mojave 10.14
Current behavior
Can't access to data by the token which generated after a session has exist to the same user. I just try build an brand new project with
mix phx.new
andmix phauxth.new --api --confirm
. You can try it here.Expected behavior
Works normally no matter how many sessions a user have.
Additional information
Second, create a new session with create session API, get a new token, said token B. Try any API and it will report:
And you can try with token A it just works fine. Try
TestPhauxth.Accounts.get_by(%{session_id: 1})
directly iniex
, it raised:It seems to be easy to solve(just modify the
get_by
function inAccounts
), but I'm not sure is there any wrong in Phauxth library, I have tried to read the code in library but I didn't find anything weird. And this didn't happen in todoapp example.