MoralisWeb3/unity-web3-game-kit

"code":206,"error":"Insufficient auth."

btcgames opened this issue · 8 comments

Get error when using user.SaveAsync();

File UniversalWebClient.cs line 87
try
{
await webRequest.SendWebRequest();
}
catch (Exception exp)
{
Debug.LogError($"Target: {httpRequest.Target}");
Debug.LogError($"Error: {exp.Message}");
}

Error: HTTP/1.1 400 Bad Request
{"code":206,"error":"Insufficient auth."}

Sometimes I can save the user, but only 1 time.

I used versions 1.2.1 and 1.2.5

Seems the same error as me in #118

i also get this error when i try to save _User data or custom user class data, save works on other classes like Monster example
I can only save user first ~20 seconds from authentication then save breaks

I tried
SDK version 1.1.0, 1.2.4 and 1.2.5
Unity version 2020.3.30f1, 2021.1.15f1 and 2021.3.3f1

i also get this error when i try to save _User data or custom user class data, save works on other classes like Monster example I can only save user first ~20 seconds from authentication then save breaks

I tried SDK version 1.1.0, 1.2.4 and 1.2.5 Unity version 2020.3.30f1, 2021.1.15f1 and 2021.3.3f1

Have you solved the problem?

There was a security update on the backend that now re-validates the signature everytime it is posted. I will need to add a patch for this in the Unity SDK.

For now to get past the issue, before you call user.SaveAsync(), clear the authData array. For example:

user.authData.Clear();
await user.SaveAsync();

Do the same for custom data objects.

There was a security update on the backend that now re-validates the signature everytime it is posted. I will need to add a patch for this in the Unity SDK.

For now to get past the issue, before you call user.SaveAsync(), clear the authData array. For example:

user.authData.Clear();
await user.SaveAsync();

Do the same for custom data objects.

Thank you

When I implement this fix, it seems to solve the original error posted, but when I subsequently try to retrieve the wallet information, it can't find the eth address, so I get another error:
KeyNotFoundException: The given key 'moralisEth' was not present in the dictionary.