Here is my base64 encoded String :
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJkMjNiN2ViMy03MDgyLTRkZDktOGQ0OC1lMjU2YTM3OTNiOTciLCJyZWZyZXNoVG9rZW4iOiJiN2M3MTc4Yi04OWRjLTQxMDctYjUzNC1hOGZiOTNhMzEwNzAiLCJuYW1lIjoiTGVuIiwiaWF0IjoxNTczMDI4MjU2fQ
Using https://jwt.io/ it decodes correctly
But When trying to use base64.decode('--Base64String--);
in Flutter it gives me these errors
FormatException: Invalid character (at character 37)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiIzYWNiNzBjZS0wYzYxLT...
When removing the string in front of the .
(I only need the info that comes after the .
)
I get this error
FormatException: Invalid length, must be multiple of four (at character 183)
...jLTQxMDctYjUzNC1hOGZiOTNhMzEwNzAiLCJuYW1lIjoiTGVuIiwiaWF0IjoxNTczMDI4MjU2fQ
Are there any other ways of decoding base64 encoded Strings for Dart
jose
package to deal with JWT, maybe you can give it a try.
characters, then base64 decode the individual parts. (Then UTF-8 and JSON decode the parts to get the original data).