🛠️Set up your own auth URL
Last updated
Last updated
Create your own Firebase Project on: https://console.firebase.google.com/
Add "Authentication" to your Project:
Add "Anonymous" (to retrieve pairing code) and at least one other sign-in method. We suggest "Email/Password" and "Google" sign in (as they don't need any extra step):
Add "Realtime Database" to your Project:
Select Database Location and any security rule (we will change this in next step):
Now switch to the "Rules" tab, paste the code below and click "Publish" (these rules ensure that users can only read/write their own data):
Add "Hosting" to your Project:
Following the steps below to set up Firebase Hosting:
Afterwards copy the "index.html" which is delivered with the AuthPair Unity package (in Web folder) to the currently created "public" folder:
... and run firebase deploy
in your command line to deploy the new index file.
Then you should find your own auth page on https://[YOUR_PROJECT_ID].web.app
Finally open the AuthPair Demo scene in Unity or add the AuthPair prefab to your scene as described in Get Started
Then copy the "Realtime Database" path and the "API Key" (from Firebase Project Settings) into the Firebase Auth Script (Settings in AuthPair prefab) as shown on the Screenshot below:
And change the URL of the "AuthInstruction" text to your own auth page: https://[YOUR_PROJECT_ID].web.app
Now run your Unity scene, klick "Sign In", enter the shown pairing code on your newly created auth page and click "Connect Device".
You'll see that your Unity scene automatically logs in and the moving game objects are updating your Firebase Realtime Database every second:
If you stop and run the scene again, the objects and score will continue with the previous position and score since those values were saved in the database.
Because the object data (position, rotation, scale) and the text value is stored in the user account and not on the device, you now have a Device Independent Storage.
That means, even if you run the app/game on another device you still have the same data