React-Moralis + Unity WebGL Single Authentication

Hi,

I am creating a React app with Moralis SDK that also hosts a Unity game on the client side.

The goal is to prevent the user from having to authenticate both in React and Unity. We have Player data stored in the Moralis Mongo DB that inherits the ACL of the User. We would like to access the Player data on the Unity game load and update player data on game level completion.

Is it possible to safely use the initial authorization used in the react code to authenticate within the unity game at the same time? If not, is it possible to safely pass data into the Unity canvas utilizing the auth present in React?

Hi this library may be useful: react-unity-webgl - npm (npmjs.com)

We used this for a Unity project where we passed down the connected wallet address to the canvas to be displayed in the game to demonstrate a basic integration. The issue with this is if it’s secure.

Ultimately the safest way is to also authenticate within the game.

It’s worth asking developers of games like Skyweaver how they handle it.

Yes that’s exactly how we are doing it currently. As you said its not necessarily the safest solution.

Ideally if we can pass the moralis Auth to Unity we will have access to server side logic via cloud functions which would be more secure then trusting messages being sent back and forth between client and the Unity build.

Was Skyweaver built with Moralis?

Have you looked at Moralis’s Unity SDK? It may have what you’re looking for. Like a secure interaction from the Moralis SDK on the frontend to their Unity side.

No that was just an example but basically the same principles would apply if they used Moralis or their own infrastructure.

I think this may help: Ethereum Unity3D Boilerplate Questions