Android Question JWT for B4A

Solution
Ciao Luciano,
the decode is very simple
first, you need to "split" the string with the "." character
then Base64 Decode and......

eyJhbGci0iJIUzI1NiIsInR5cCI6IkpXVCJ9 = {"alg""HS256","typ":"JWT"}

eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6M
TY5MjQ4MjQ1MCwiaWF0IjoxNjkyMzk2MDUwLCJq
dGki0iJkZTg20TcyMzEwOWE0MzBmYjI4YjIxODR
hZWNlODY3ZiIsInVzZXJfaWQi0jh9 = {"token_type":"refresh","exp":1692482450,"iat":1692396050,"jti""de86723109a430fb28b2184aece867f","user_id"8}

then with the first and second part of base64 datas, you need to execute a HMAC-SHA-256 and check it

I think that you don't need a library

aeric

Expert
Licensed User
Longtime User
There is a code to check the JWT token expiry inside the B4J-SendTool

Maybe it works.
 
Upvote 1

Luciano Veneziano

Active Member
Licensed User
Longtime User
Thanks aeric!
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
Ciao Luciano,
the decode is very simple
first, you need to "split" the string with the "." character
then Base64 Decode and......

eyJhbGci0iJIUzI1NiIsInR5cCI6IkpXVCJ9 = {"alg""HS256","typ":"JWT"}

eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6M
TY5MjQ4MjQ1MCwiaWF0IjoxNjkyMzk2MDUwLCJq
dGki0iJkZTg20TcyMzEwOWE0MzBmYjI4YjIxODR
hZWNlODY3ZiIsInVzZXJfaWQi0jh9 = {"token_type":"refresh","exp":1692482450,"iat":1692396050,"jti""de86723109a430fb28b2184aece867f","user_id"8}

then with the first and second part of base64 datas, you need to execute a HMAC-SHA-256 and check it

I think that you don't need a library
 
Last edited:
Upvote 0
Solution

Luciano Veneziano

Active Member
Licensed User
Longtime User
Thanks!!!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…