readJWTbody ( )
Be the first to rate this function Log in to vote
David A Sullivan - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
However, FileMaker's base64decode() function sometimes chokes on decoding that middle section. This is due to the fact that base64 is a 6-bit encoding scheme. In order to decode base64 to binary (which is encoded in 8-bit bytes) base64 must have padding added to the end if it does not contain a number of bits that adds up to a multiple of 24.
In other words:
Binary has 8 bits per unit, and base64 has 6 bits per unit, so if you land on something that's not a multiple of 24 bits, FileMaker's base64decode doesn't know what to do with the remainder. you have a handful of indecipherable bits, so FM returns a ?. So, I wrote this handy custom func to add "=" symbols, also known as "padding".
Updated 2023-10-16 to accept Base64url (special thanks to Josh Willing Halpern)
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.