Articles

Affichage des articles associés au libellé jwt

Checking your win by inwi balance on a terminal

Here's how you can check your win data usage on a terminal because <note to self: insert convincing reason here before publishing> Time for some recon. I fired off the Firefox network devtools and started inspecting. There are two endpoints of interest: Login endpoint (/api/v1/auth/login): exchanges a username/password combo for a set of tokens Offer detail endpoint (/api/v1/subscriptions/<ID>/offer-detail): returns statistics about the subscription After decoding the JWT access token returned by the login endpoint, I notice that its exp claim has a generous time to live of about 7 days. The refresh token lasts twice as long. For starters I decided to use this set of tokens instead of writing code that actually logs me in, it might come in handy if they ever decide to slap a captcha on the login form. For the record, here's what the login response looks like: { "account": { "email": "yours.truly@domain.ext", ...

Decoding JWTs in the terminal

Image
These past few days, I have been working on integrating IBM App ID into our Java backend and Android frontend codebases. Because of this, I would find myself going back and forth between the terminal and JWT.io whenever I need to inspect a JWT's payload. I don't want to call it a "JWT token" because that would be a bad case of RAS and I'm pedantic like that, but I digress. Instead of relying on a website to do that for me, I figured why not just do it from the terminal. I did some reading and it turns out that JWTs are relatively easy to parse : Split the token using the dot character as a delimiter Base 64 decode the first portion to get the header Base 64 decode the second portion to get the payload The third portion serves as a signing mechanism for the token. I chose to ignore the signing logic for the script I intended to write because it was irrelevant for my use case. I ended up writing a command line tool in D to help me inspect JWTs. The ma...