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

**URL:** <https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314>\
**Category:** Get Help\
**Tags:** api, bug, auth0\
**Created:** [May 31, 2022, 12:21pm UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314 "2022-05-31T12:21:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kagan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kagan/32/37732_2.png) [@kagan](https://community.auth0.com/u/kagan)\
**Post date:** [May 31, 2022, 12:21pm UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314/1 "2022-05-31T12:21:54Z")

</div>

Hello,

We are developing a VR application using Unity, and for that I set up Auth0 inside using the guidelines here:

> **[GitHub - auth0-lab/auth0-unity: An experimental Auth0 SDK for Unity platform.](https://github.com/auth0-lab/auth0-unity)**
>
> An experimental Auth0 SDK for Unity platform. Contribute to auth0-lab/auth0-unity development by creating an account on GitHub.

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

```auto
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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 31, 2022, 12:27pm UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314/2 "2022-05-31T12:27:53Z")

</div>

Hey there!

What I suggest here is to raise a GitHub issue in the repo so we can get direct help from one of the maintainers. Thank you! Once you have a link to it you can share it here so we can ping them.

---

<div class="post-metadata">

**Author:** ![subodh.pahalajani](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/subodh.pahalajani/32/49106_2.png) [@subodh.pahalajani](https://community.auth0.com/u/subodh.pahalajani)\
**Post date:** [August 29, 2023, 5:51am UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314/3 "2023-08-29T05:51:06Z")

</div>

Hello was this issue resolved?  
as I’m also getting the same error

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [July 18, 2024, 10:51am UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314/4 "2024-07-18T10:51:41Z")

</div>

We are trying to provide solutions to the most-viewed topics. As for now, it is best to follow the provided workaround by the community member in the issue itself → [JsonSerializationException: Unable to find a constructor for Auth0.AuthenticationApi.Models.DeviceCodeResponse · Issue #11 · auth0-lab/auth0-unity · GitHub](https://github.com/auth0-lab/auth0-unity/issues/11#issuecomment-1260510749).

I can’t provide any ETA about the patch as this POC experimental library is not on the team radar now.

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 1, 2024, 10:52am UTC](https://community.auth0.com/t/jsonserializationexception-unable-to-find-a-constructor-for-auth0-authenticationapi-models-devicecoderesponse/84314/5 "2024-08-01T10:52:21Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
