breaking when optional parameters omitted
Hi,
Some parameters are optional, as per the API doc but lib breaks if not provided. This is specific of the typeScript lib, doesn't happen on node-client. It comes from the formData builder.
How to reproduce:
call
exchangeRefreshTokenForAccessToken('refreshToken', 'clientId', 'clientSecret')
Expected Result:
Request should be sent.
It should work with only those parameters, particularly, scope is optional. see doc: https://fusionauth.io/docs/v1/tech/oauth/endpoints#request-parameters-7
Actual result:
Type error at ligne https://github.com/FusionAuth/fusionauth-typescript-client/blob/2e36aa641a6e98782aef92ec0f5be671f2475819/src/FusionAuthClient.ts#L853
because scope isn't provided
TypeError: Cannot read property 'name' of undefined
at FormData._getContentDisposition (/PATH/node_modules/@fusionauth/typescript-client/node_modules/form-data/lib/form_data.js:226:40)
at FormData._multiPartHeader (/PATH/node_modules/@fusionauth/typescript-client/node_modules/form-data/lib/form_data.js:177:33)
at FormData.append (/PATH/node_modules/@fusionauth/typescript-client/node_modules/form-data/lib/form_data.js:70:21)
at FusionAuthClient.exchangeRefreshTokenForAccessToken (/PATH/node_modules/@fusionauth/typescript-client/build/src/FusionAuthClient.js:795:14)
Note:
Works on the node-client: https://github.com/FusionAuth/fusionauth-node-client/blob/3a36b95c04eb8e103967ca49c6548e6c4fdc0ef8/lib/FusionAuthClient.js#L928
Cheers
Hi,
I believe this is fixed in 1.16.1. Feel free to try it out.
I'm using 1.31.0 and this is not fixed yet.