Need help!! I am trying to decode the JWT token, but I wanted it to show actually useriD instead of a long string. I have no idea how to solve it, can anyone help me fox this problem? and please explain what went wrong as well, thanks!!!

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 4PE
icon
Related questions
Question
I am very new to react JS.
Need help!! I am trying to decode the JWT token, but I wanted it to show actually useriD instead
of a long string. I have no idea how to solve it, can anyone help me fix this problem? and please
explain what went wrong as well, thanks!!!
Transcribed Image Text:I am very new to react JS. Need help!! I am trying to decode the JWT token, but I wanted it to show actually useriD instead of a long string. I have no idea how to solve it, can anyone help me fix this problem? and please explain what went wrong as well, thanks!!!
let user storage.retrieveToken();
if (user == null) {
user = null;
} else {
user = JSON.stringify(jwt_decode(user));
}
return(
<div>
Hello user
<ResponsiveAppBar />
<h1>Handler</h1>
<h2>Hello user: (user) </h2>
"userId":"62469e2b1de6dd8c34e49cf4","firstName":"bee","lastName":"nice","lat":1648796862)
exports.retrieveToken .
var ud;
try
{
}
function ()
{
ud localStorage.getItem('token_data');
}
catch(e)
{
console.log(e.message);
}
return ud;
Transcribed Image Text:let user storage.retrieveToken(); if (user == null) { user = null; } else { user = JSON.stringify(jwt_decode(user)); } return( <div> Hello user <ResponsiveAppBar /> <h1>Handler</h1> <h2>Hello user: (user) </h2> "userId":"62469e2b1de6dd8c34e49cf4","firstName":"bee","lastName":"nice","lat":1648796862) exports.retrieveToken . var ud; try { } function () { ud localStorage.getItem('token_data'); } catch(e) { console.log(e.message); } return ud;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,