I made jwt authorization and I stored that token into session storage , but when i try to get that token into string and log it i get null , this is the function
login(user : User): void
{
this.header= new Headers({"content-Type": "application/json"});
this.osobaService.create(user,this.tokenUrl,this.header).then(p=> {sessionStorage.setItem("Token",p._body.slice(1,-1))});
this.tokenString = sessionStorage.getItem("Token");
console.log(this.tokenString);
}
It should be simple getItem method but I'm getting null .