possible unhadled promise rejection (id: 0) typeError 0,_jwtDecode.default is not a function (it is undefined)

22 Views Asked by At

When installing jwt-decode to decode the access token of a user in my React-Native application, we encounter the following error. How could this be fixed, is the library updated and/or the code?

Code:

import jwtDecode from "jwt-decode";

export function hasExpiredToken(token) {
const data = jwtDecode(token);
console.log(data);
return false;
}

Error: possible unhadled promise rejection (id: 0) typeError 0,_jwtDecode.default is not a function (it is undefined)

Thank you

If we do a console log of the token, it returns the previously generated token correctly, so it's not a token assignment issue.

0

There are 0 best solutions below