Home > Mobile >  Remove escape characters in AccessToken in Flutter
Remove escape characters in AccessToken in Flutter

Time:11-22

I'm using this package (enter image description here

Many thanks in advance for any help!

CodePudding user response:

A jwt token's payload looks like what you've shown in the image. Usually an encoded jwt token will look like this:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Your token is likely invalid on the server because you are sending the decoded payload instead of the encoded token.

CodePudding user response:

If you want to remove escape characters from your string you can try this:

String result = "your token".replaceAll(r"\'", "'");
  • Related