Message from JavaScript discussions

November 2020

— Love you thanks

— 

Auth.ls from that project

"use strict"
window.addEventListener 'load', !->
# get nodes
nodeMap =
form: document.querySelectorAll '#auth form' .0
btnSubmit: document.querySelectorAll '#auth button' .0
roleName: document.querySelectorAll '#auth h3' .0
inputs: [...(document.querySelectorAll '#auth .input')]
switch: [...(document.querySelectorAll '#auth .switch svg')]
img: [...(document.querySelectorAll '#auth img')]
# ...

— How to protect client side routes if I got a json web token from my API

— Like if I go to dashboard how do I verify if the user is logged in through the rest API

— You set header cookie and it is sent in every request, that's a session identifier of the user

— Yes but do you mean like a javascript cookie

— So on my function before I set a cookie

— With the jwt token

— Cookie is set by the server in the response

— Here it returns my jwt token how to start a session from here

— Tokens are used for short communications between client and external server or server-server

— Oke but if my fetch returns a valid status and token how to start or set a header?