Skip to content

FusionAuth Typescript client does not correctly create GET queries with multiple values for a single parameter #2513

@lyleschemmerling

Description

@lyleschemmerling

FusionAuth Typescript client does not correctly create GET queries with multiple values for a single parameter

Description

When the FusionAuthClient in typescript constructs the query string for a GET url if the value for the parameter is an array it will naively pass it into encodeURIComponent instead of creating repeated instances of the parameter. The result is, for the user search api for example:

/api/user/search?ids=00000000-0000-0000-0000-000000000001%2C00000000-0000-0000-0000-000000000002

When FusionAuth expects:

/api/user/search?ids=00000000-0000-0000-0000-000000000001&ids=00000000-0000-0000-0000-000000000002

Additionally the Search API and similar methods should probably call POST instead as the query parameter as a URL is potentially a constraint.

Affects versions

= 1.4.0

Steps to reproduce

Steps to reproduce the behavior:

  1. Attempt to call client.searchUsersByIds(ids) with an array with multiple values such as ["00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002"].

You should see the following error:

{
    "fieldErrors": {
        "ids": [
            {
                "code": "[couldNotConvert]ids",
                "message": "Invalid"
            }
        ]
    },
    "generalErrors": [
        {
            "code": "[invalid]",
            "message": "You must specify either the [ids], [queryString], or [query] property."
        }
    ]
}

Expected behavior

URLs should use repeated parameters and the call should succeed

Related

Community guidelines

All issues filed in this repository must abide by the FusionAuth community guidelines.

Release notes

The FusionAuth TypeScript client library is incorrectly encoding array values into query parameters. This is preventing some search queries from being made.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Delivered

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions