Running a self hosted server in Unity: Problem with merged AuthKit.cs

Hey dear Moralis-Team,

Im using the self hosted server and was able to use the Moralis Power Up NFT game with my parse server. Like End of November the Auth worked with the help of Alex by making changes to the Auth-Kit.cs and now after i opened the project it didnt work anymore. I ve also seen that David did some changes and shared it in here:

I replaced all the changes and im still getting the NullReferenceExcpetion error in Unity.
I also contacted Alex and the Moralis Community in discord still dont get a response. So Filipe told me to post the problem on the forum.

I also made a discord post on this where all the information is provided:

Im using:

  • Unity editor version: 2021.3.6f1

Thanks for your help!

Hi @Uffi, I’m checking this out. Will get back to you with a solution.

1 Like

Hey David thanks for your help. The Auth is working right now. While our meeting a few things didnt work and i was handle to get rid of some errors.
Then only error left right now is the following in the Power-Up-NFT Game:

Error calling GetNFTsForContract: {“error”:“unauthorized”}
UnityEngine.Debug:LogError (object)
NFT_PowerUp.Inventory/d__8:MoveNext () (at Assets/_Project/Scripts/UI/Inventory.cs:123)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTask.cs:21)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1<MoralisUnity.Web3Api.Models.NftOwnerCollection>:TrySetException (System.Exception) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTaskCompletionSource.cs:167) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.CloudApi.AccountApi/d__14, MoralisUnity.Web3Api.Models.NftOwnerCollection>:SetException (System.Exception) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:334)
MoralisUnity.Web3Api.CloudApi.AccountApi/d__14:MoveNext () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/Web3Api/CloudApi/AccountApi.cs:450)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.CloudApi.AccountApi/<GetNFTsForContract>d__14, MoralisUnity.Web3Api.Models.NftOwnerCollection>:Run () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:313) Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTask.cs:21) Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1<System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:TrySetResult (System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTaskCompletionSource.cs:139)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.Client.ApiClient/<CallApi>d__12, System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:SetResult (System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:328) MoralisUnity.Web3Api.Client.ApiClient/<CallApi>d__12:MoveNext () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/Web3Api/Client/ApiClient.cs:137) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.Client.ApiClient/d__12, System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:Run () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:313)
Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTask.cs:21)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore1<System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:TrySetResult (System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/UniTaskCompletionSource.cs:139) Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.UniversalWebClient/d__7, System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:SetResult (System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:328)
MoralisUnity.Web3Api.UniversalWebClient/d__7:MoveNext () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/Web3Api/UniversalWebClient.cs:113)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask2<MoralisUnity.Web3Api.UniversalWebClient/<ExecuteAsync>d__7, System.Tuple3<System.Net.HttpStatusCode, System.Collections.Generic.Dictionary2<string, string>, string>>:Run () (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/CompilerServices/StateMachineRunner.cs:313) Cysharp.Threading.Tasks.Internal.PooledDelegate1<UnityEngine.AsyncOperation>:Run (UnityEngine.AsyncOperation) (at Library/PackageCache/io.moralis.web3-unity-sdk@464a521a2a/Runtime/External/UniTask/Runtime/Internal/PooledDelegate.cs:46)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()

The Problem is solved. David helped out. Thanks a lot David. Everything is working :slight_smile:

2 Likes