smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

Server credential store returning nil #392

Closed kdiogenes closed 5 years ago

kdiogenes commented 5 years ago

I'm using phoenix 1.4.0-rc0 and elixir 1.7.3 and executing the following in iex:

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Coherence.CredentialStore.Server.put_credentials("foo", 1)
:ok
iex(2)> Coherence.CredentialStore.Server.get_user_data("foo")
nil

I'd expect it to return 1.

Is it an incompatibility with phoenix 1.4 or I'm making wrong assumptions about how credential store works?

smpallen99 commented 5 years ago

As you can see from this line of code, user_data must be a map or struct with a :id field.

kdiogenes commented 5 years ago

Thanks for quick feedback @smpallen99, it worked perfectly!

I get mislead by https://hexdocs.pm/coherence/Coherence.Authentication.Token.html#add_credentials/3 documentation. I will submit a PR soon.

Thanks!