Skip to content

JsonSerializationException: Unable to find a constructor for Auth0.AuthenticationApi.Models.DeviceCodeResponse  #11

Description

@kturnal

Hello, I posted this issue in Auth0 Community forum (see here) and it was suggested to raise an issue here as well.

We are developing a VR application using Unity, and for that I set up Auth0 inside using the guidelines here:
https://github.com/auth0-lab/auth0-unity

It is already working in Unity Editor, but on the device (Android) it is throwing this exception:

2022.05.31 10:48:16.705 5710 5760 Error Unity JsonSerializationException: Unable to find a constructor to use for type Auth0.AuthenticationApi.Models.DeviceCodeResponse. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'device_code', line 1, position 15.
2022.05.31 10:48:16.705 5710 5760 Error Unity   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract objectContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Newtonsoft.Json.Serialization.JsonProperty containerProperty, System.String id, System.Boolean& createdFromNonDefaultCreator) [0x00000] in <00000000000000000000000000000000>:0
2022.05.31 10:48:16.705 5710 5760 Error Unity   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract contai

The problem is coming from this line of code on Unity side:

AuthManager.Instance.Auth0.ExchangeDeviceCodeAsync(clientId, deviceCodeResp.DeviceCode, deviceCodeResp.Interval);

Since the problem is coming from a class in the DLL, I can't modify it to resolve the issue. Did anybody encounter something similar and can help?

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions