K
Kindethis hour
Joel

.NET Get Users JSON Serialization Error

When using the .NET SDK, I'm trying to use an M2M flow to get user information. The M2M application has the get:users scope for the Management API and I've set up a simple .NET test app to retrieve and print users based on the .NET SDK documentation (https://docs.kinde.com/developer-tools/sdks/backend/dotnet-sdk/#configure-api-client) but it looks like there is a JSON serialization error for the response coming back. Am I doing something wrong in setting up this call to Management API? Exception has occurred: CLR/Kinde.Api.Client.ApiException An exception of type 'Kinde.Api.Client.ApiException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Kinde.Api.Client.Option1[System.Collections.Generic.List1[Kinde.Api.Model.UsersResponseUsersInner]]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path 'users', line 1, position 25.' at Kinde.Api.Client.CustomJsonCodec.<Deserialize>d7.MoveNext() at Kinde.Api.Client.CustomJsonCodec.<Deserialize>d61.MoveNext() at Kinde.Api.Client.ApiClient.<ExecAsync>d__221.MoveNext() at Kinde.Api.Api.UsersApi.<GetUsersWithHttpInfoAsync>d65.MoveNext() at Kinde.Api.Api.UsersApi.<GetUsersAsync>d64.MoveNext() at Program.<<Main>$>d__0.MoveNext() in c:\repos\chill-warrior\kinde-test\Program.cs:line 17
Kinde docs
.NET SDK
Guide to using the Kinde .NET SDK for integrating with the Management API, including installation, configuration, and API calls for user and organization management.
No description
4 Replies
Abdelrahman Zaki - Kinde
Thanks for sharing the details @Joel. To better understand what’s happening, could you please share the file where you’re making the call to the Management API? That way I can take a closer look. If you’re more comfortable, you can also share it with us directly via [email protected]. Feel free to remove or redact any sensitive information before sharing.
Joel
JoelOP21h ago
Here's the file. It's a pretty simple .NET console app.
Abdelrahman Zaki - Kinde
Thanks for sharing the file, @Joel. I’ll take a closer look and get back to you shortly. Thanks again for sharing the file, @Joel. I’ll need to check in with one of our experts on this. Since we’re heading into the weekend, you can expect to hear back from us on Monday.
Stephen
Stephen10h ago
This looks like it's a bug that's already been reported by another user. See https://discord.com/channels/1070212618549219328/1416588534101577728 I would suggest that the newer versions of the .NET SDK are unusable until it gets resolved. Joel, I suspect if you downgrade your Nuget package down to the version tested by the bug reporter it will fix your issue until a proper fix is introduced.

Did you find this page helpful?