代码之家  ›  专栏  ›  技术社区  ›  optimus

无法读取null的属性“decode”:react native pure jwt

  •  0
  • optimus  · 技术社区  · 2 年前

    我在使用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不能解决问题

    需要帮助。

    0 回复  |  直到 2 年前