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 handling of URL Parameters #20

Open
TruDan opened this issue Jun 3, 2020 · 3 comments
Open

Incorrect handling of URL Parameters #20

TruDan opened this issue Jun 3, 2020 · 3 comments
Assignees

Comments

@TruDan
Copy link

TruDan commented Jun 3, 2020

I'm trying to call IFusionAuthAsyncClient.SearchUsersByIdsAsync(List<string> ids) but if say i give the id's a list containing:
["1a4a9247-2b9d-45d2-ae1e-4714756b5a58","5a1505df-677e-44e3-9c09-d858087eac7b"]

This results in an exception:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at async Task<IEnumerable<UserDto>> HeroBalancer.Repo.Stores.FusionAuth.FusionAuthUserStore.ReadByIds(Guid[] ids) in /build/src/Repo/Stores/FusionAuth/FusionAuthUserStore.cs:line 73

In FusionAuth, there is a very unhelpful error message which doesnt tell me much about the issue:
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Eventually, i find in our Nginx-Ingress-Controller logs, the request that was actually made:

2020-06-03 11:33:32 | 10.244.1.219 - - [03/Jun/2020:09:33:32 +0000] "GET /api/user/search?ids=System.Collections.Generic.List%601[System.String] HTTP/1.1" 400 1985 "-" "-" 367 0.003 [default-fusionauth-80] [] 10.244.0.159:9011 1985 0.004 400 f6eaaa076541fc2a1d196711554fb795

Here you can see the ids parameter has been serialized incorrectly. According to the API documentation at https://fusionauth.io/docs/v1/tech/apis/users#search-for-users
this should be serialised as so:
ids=1a4a9247-2b9d-45d2-ae1e-4714756b5a58&ids=5a1505df-677e-44e3-9c09-d858087eac7b

@TruDan
Copy link
Author

TruDan commented Jun 3, 2020

Related to this, in io.fusionauth.DefaultRESTClient "parameters" should be a List<KeyValuePair<string, string>> then you may add multiple parameters with the same Key. Otherwise you must handle this differently

kennyvv pushed a commit to HeroBalancer/fusionauth-netcore-client that referenced this issue Jun 5, 2020
@TruDan
Copy link
Author

TruDan commented Jun 15, 2020

This is fixed in #22 - Can you merge this? It's a big roadblock for us currently, forcing us to package our own fork of this library to NuGet so we can use the changes and make progress with our feature releases

robotdan added a commit that referenced this issue Jun 15, 2020
@robotdan
Copy link
Member

PR is included in released version 1.17.1 of the client.
https://www.nuget.org/packages/FusionAuth.Client/

@robotdan robotdan self-assigned this Jun 15, 2020
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