Hi Jay,

I had the same problem with my small JWT library.

The easiest way to decode a base64url encoded string is, you have to do:

1. replace all "-" with "+"
2. replace all "_" with "/"
3. try to decode as base64
4. if it fails, append "=" and try to decode again as base64
5. if it fails, append another "=" and try to decode again as base64

I implemented that in RPG and the base64 decode with SQL (because I'm lazy).

HTH
Daniel


Am 04.03.2025 um 20:27 schrieb Jay Vaughn <jeffersonvaughn@xxxxxxxxx>:

I'm looking at decoding a jwt and discovered it can be base 64 decoded but
not just base64 but base64 URL.

I know we have the qsys2.base64_decode scalar function provided by db2 -
but what about a base64 URL version?

OR does someone know a simple way to decode the jwt using native languages
and sql/db2 on the IBM i?

It is my understanding there is a header/body/footer(signature) in each -
it is the body that is decodable.

any suggestions?

tia

Jay
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.