plaid-node icon indicating copy to clipboard operation
plaid-node copied to clipboard

Incorrect typings on JWTHeader interface

Open kevinohara80 opened this issue 1 year ago • 1 comments

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'.

kevinohara80 avatar Oct 11 '24 15:10 kevinohara80

@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.

phoenixy1 avatar Oct 11 '24 18:10 phoenixy1

This has been fixed in yesterday's release of the client library.

phoenixy1 avatar Nov 15 '24 17:11 phoenixy1