Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect typings on JWTHeader interface #649

Open
kevinohara80 opened this issue Oct 11, 2024 · 1 comment
Open

Incorrect typings on JWTHeader interface #649

kevinohara80 opened this issue Oct 11, 2024 · 1 comment

Comments

@kevinohara80
Copy link

In prior version of the Plaid SDK, the JWTHeader interface included properties like kid which are required for webhook verification. Now the JWTHeader definition only includes a single id property and is missing the other header information.

This used to work but now fails:

import jwt_decode from 'jwt-decode';
import { JWTHeader } from 'plaid';

const decodedTokenHeader = jwt_decode<JWTHeader>(signedJwt, {
  header: true
});
Property 'alg' does not exist on type 'JWTHeader'.
Property 'kid' does not exist on type 'JWTHeader'.
@phoenixy1
Copy link
Contributor

@kevinohara80 thanks for the report! Honestly, the JWTHeader object possibly should not be in the SDK at all, since it is not directly part of the interface, but rather something that the user has to extract from the verification header. It also does not appear to be heavily used, since I believe it's been defined like this since 2020 and this is the first bug report we've gotten on it :-). However, for compatibility reasons, we can update the definition in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants