question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to extract payload

See original GitHub issue

I have created this function to extract the payload

async fetchPayload(token: string):Promise<object> {
    const data = await validateJwt(token, key, { isThrowing: false });
    return data.payload;
  },

but I am getting this error

TS2322 [ERROR]: Type 'Payload | undefined' is not assignable to type 'JwtObject | null'.
  Type 'undefined' is not assignable to type 'JwtObject | null'.
      return data.payload;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
halvardssmcommented, Jun 7, 2020

@timonson I think this is a really good implementation 👍 I would maybe change the validation type to the example below to always return the JwtObject in the jwt prop, but I think both ways have their pros and cons so I leave it to you:

type JwtValidation =
  | { jwt: JwtObject; isValid: true }
  | { jwt: string; isValid: false; isExpired: boolean; error: JwtError };
2reactions
dev-err418commented, May 23, 2020

Hi, to answer your question above, yes I’m currently using isThrowing. Hope it helped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extract Android OTA Payload.bin File using Payload Dumper ...
On a Windows PC: Hold the SHIFT key and right-click on an empty space inside the folder, then select the 'Open PowerShell window...
Read more >
[GUIDE]How to extract img(boot.img, etc...) from payload.bin ...
1. Download and extract payload-dumper-go. ... 2. Download and extract OxygenOS firmware zip. You can find firmware zip for all OnePlus devices ...
Read more >
How to Extract Payload.bin using Payload Dumper Tool
Method 1: Download the Factory OTA (zip) · Method 2: Unzip the OTA file · Method 3: Install Python · Method 4: Download...
Read more >
How to Extract payload.bin and get stock boot image file
STEP 1: Setup Payload Dumper Tool · STEP 2: Get the Payload.Bin File · STEP 3: Setup Python on Android · STEP 4:...
Read more >
Android OTA payload extractor written in Go. - GitHub
Usage ./android-ota-payload-extractor <OTA.zip or payload.bin>. It can parse payload.bin directly, or automatically extract from OTA zip files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found