Fork me on GitHub
#keechma
<
2018-01-23
>
sooheon17:01:06

@mihaelkonjevic in the realworld example, once the user is logged in with jwt, hot code reloading does not log one out. I’m trying to replicate the login functionality, but code changes -> hot reload keeps logging me out. Is the secret sauce in the datasources namespace (current user?)

mihaelkonjevic17:01:53

on register / login I store the JWT in local storage

mihaelkonjevic17:01:04

and then get it out from the local storage from the datasource

sooheon17:01:34

Hah! I thought I’d done that, turns out I spelled the local storage key differently in two places ;P

sooheon17:01:42

now I see why you have the settings ns

mihaelkonjevic17:01:31

btw, I’m still thinking about the input fields for Korean and similar language

sooheon17:01:59

let me know what I can do to help with that--my workaround now is just not fully control the form (don’t bind value)

mihaelkonjevic17:01:04

I think I have and idea how to fix it (probably on the component level), but work is kinda chaotic this week

sooheon17:01:24

sure, no rush

sooheon17:01:28

btw, how do you do keepalive/refresh for the jwt?

mihaelkonjevic17:01:25

either refresh it on each app load

mihaelkonjevic17:01:44

and return nil if it’s expired

sooheon17:01:24

mhm. so if you don’t refresh each app load, and that returns nil, that just means user needs to login again?

mihaelkonjevic17:01:52

the only issue is if the jwt expires in the middle of user’s session

sooheon17:01:17

physical session, not server session right? i thought point of jwt was to replace sessions

mihaelkonjevic17:01:49

yeah, user is clicking around and then requests start to fail because jwt is expired

sooheon17:01:57

mhm that’s pretty bad

sooheon17:01:34

it also seems you don’t really decode the jwt clientside, you jsut assume that if it exists, it means they’ve been authenticated?

sooheon17:01:55

so technically someone can just add a random string as jwt header and make calls

mihaelkonjevic17:01:01

in this project yeah, but JWT is readable on the client side

mihaelkonjevic17:01:21

only thing that it ensures is that you can’t tamper with it because of the signature