Skip to content

breaking when optional parameters omitted #19

Open
@ulybu

Description

@ulybu

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

body.append('scope', scope);

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions