Session

Session in plasma containing information about the logged user. Session are stored on the browser in two way : SessionStorage / LocalStorage

Session contains somes function

  • isPersistant <bool> return true if LocalStorage false if SessionStorage

  • setPersistent / removePersistant

  • getToken (parse the session object and get Token)

  • getUserName (parse the session object and get Username)

  • isSession <bool> true if session exist, false if session not found

  • setSession <token> <userName> : this create the session.

  • clearSession : clear the session from the storage

Session sturcture

A session is composed of two required fields :

token (must be unique for each user) you can use JWT for exemple

username (non used for backend check) it's just a simple way to get the username of a logged user

Last updated