Reputation: 2808
I want Decode of the given token.My Issue is Can't find jwt-decode. Now That time I am Using, this npm install jwt-decode,
After Installation finished, this module call in this where we are using that Component like this
var jwtDecode = require('jwt-decode');
after that i am calling in
componentDidMount(){
this.getToken()
}
getToken(){
var token ='eyJ0eXAiO.../// jwt token'
var decoded = jwt_decode(token);
alert(":"+decoded);
}
Please Suggest any one , this method or any method. Thanks in Advance.
Upvotes: 0
Views: 147
Reputation: 483
You're assigning the jwt-decode function to a variable named jwtDecode
, but your getToken
function appears to be calling jwt_decode
. If you change that to jwtDecode
, and pass in a real token (rather than the example string), it should then work.
Upvotes: 1