我在使用react native pure jwt时出错
我想使用React Native纯jwt解码React Native中的jwt。因此,我开始安装程序包,然后:
import {decode} from "react-native-pure-jwt";
decode(
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.ipevRNuRP6HflG8cFKnmUPtypruRC4fb1DWtoLL62SY", // the token
"secret", // the secret
{
skipValidation: true // to skip signature and exp verification
}
)
.then(console.log) // already an object. read below, exp key note
.catch(console.error);
我得到以下错误:
“无法读取null的属性'decode'”
之后我会:
import jwt from "react-native-pure-jwt";
jwt.decode(
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.ipevRNuRP6HflG8cFKnmUPtypruRC4fb1DWtoLL62SY", // the token
"secret", // the secret
{
skipValidation: true // to skip signature and exp verification
}
)
.then(console.log) // already an object. read below, exp key note
.catch(console.error);
我得到以下错误:
TypeError:无法读取未定义的js-engine:hermes的属性“decode”
注意:反应原生链接反应原生纯jwt不能解决问题
需要帮助。