How to get the claims from a JWT in my Flutter Application

后端 未结 3 760
旧时难觅i
旧时难觅i 2020-12-15 18:55

I am writing a Flutter/Dart application and am getting a JWT back from an auth server that has some claims I need to use. I have looked at various (4 so far) Dart JWT libra

3条回答
  •  Happy的楠姐
    2020-12-15 19:40

    Use 'base64Url.normalize()' function. That's what _decodeBase64() does from the answer above!

    String getJsonFromJWT(String splittedToken){
      String normalizedSource = base64Url.normalize(encodedStr);
      return utf8.decode(base64Url.decode(normalizedSource));
    }
    

提交回复
热议问题