reactjs - Storing json web token -


i'm learning reactjs, redux , json web token. i'm new on of them.

in sample application user sends information login page. if information true jwt created , set in state , sent client side. set localstorage. when other request sent client, token in localstorage sent server via redux action verifying.

i read samples , tutorials. of them have sent jwt in http header.

do have sent header ? localstorage , state enough ?

do have sent header?

you must send server in request somehow. whether header or part of request's payload, doesn't matter, more convenient , considered better practice send part of authorization header. using authorization header allow avoid moving jwt between request's body , query parameters depending on type (post / etc.).

are localstorage , state enough?

no. storing jwt locally on client not inform server of client's authenticated state. must send jwt server each request requires user authorisation.

do reading around jwt. there plenty of links , libraries available online. here 1 started.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -