riverrun / phauxth

Not actively maintained - Authentication library for Phoenix, and other Plug-based, web applications
409 stars 20 forks source link

[BUG] Token generated later to same user can't work properly #102

Closed hiroya8649 closed 5 years ago

hiroya8649 commented 5 years ago

Environment

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 and mix phauxth.new --api --confirm. You can try it here.

Expected behavior

Works normally no matter how many sessions a user have.

Additional information

It seems to be easy to solve(just modify the get_by function in Accounts), 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.

riverrun commented 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.

hiroya8649 commented 5 years ago

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.

riverrun commented 5 years ago

I will fix the installer in a day or two.

riverrun commented 5 years ago

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?

hiroya8649 commented 5 years ago

@riverrun I have try with the newest 2.0.0 installer and it works fine, thanks for your quick fix!