Skip to content

Bug: Incorrect JsonConverter type used on User model #1082

Description

@ZeBobo5

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

The User model uses StringOrObjectAsStringConverter, which is a converter implemented for System.Text.Json.

However, the property is decorated with the Newtonsoft.Json JsonConverter attribute:

[JsonConverter(typeof(StringOrObjectAsStringConverter))]

Newtonsoft.Json.JsonConverter and System.Text.Json.Serialization.JsonConverter are not compatible, so this converter will never work correctly with Newtonsoft and may even result in runtime or compilation issues depending on the implementation.

Reference:

[JsonConverter(typeof(StringOrObjectAsStringConverter))]

I believe the converter should either:

  • be replaced with a Newtonsoft.Json.JsonConverter implementation, or
  • the model should consistently use System.Text.Json attributes and converters if the SDK is migrating away from Newtonsoft.

Reproduction

Just make a call to user by email endpoint.

Additional context

System.InvalidCastException: Unable to cast object of type 'Auth0.Core.Serialization.StringOrObjectAsStringConverter' to type 'Newtonsoft.Json.JsonConverter

auth0.net version

7

.NET version

10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions